Read pubsub message publish time using Apache beam with Google dataflow

This is a simple message to read publishTime of a message when reading using PubSub IO.

@ProcessElement
    public void processElement(DoFn<String, MessageDTO>.ProcessContext c) throws Exception {
       
        MessageDTO dataPacket = c.element();
       
        Instant time = c.timestamp();
      
        dto.setPubsubTimestamp(time.toDateTime());

        c.output(dto);
       }

Comments

Popular posts from this blog

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

Upload csv file at Google Cloud Storage using java

Read Images from a xlsx file using Apache POI