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); }