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

Read Images from a xlsx file using Apache POI

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

How to create mail message in FRC822 format