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

Read Excel using Apache POI - Exception in thread "main" org.apache.poi.poifs.filesystem.OfficeXmlFileException:

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