Hi Derek,

The publish time is the element's timestamp, retrievable via 
DoFn.ProcessContext#timestamp, unless you've configured a timestamp attribute 
with PubsubIO.Read#withTimestampAttribute. As far as I know, payload, 
attributes and publish time is all you get. What other information from 
Google's PubsubMessage are you looking for?


Reinier

________________________________
From: Derek Hao Hu <[email protected]>
Sent: 30 September 2017 03:18:13
To: [email protected]
Subject: How to get the PublishTime of PubsubMessages?

Hi,

​I'm trying to use 
[PubsubIO](​https://beam.apache.org/documentation/sdks/javadoc/2.1.0/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.html)
 to read 
[PubsubMessage](https://beam.apache.org/documentation/sdks/javadoc/2.1.0/org/apache/beam/sdk/io/gcp/pubsub/PubsubMessage.html).

I've noticed that the PubsubMessage class in Beam only exposes Attribute and 
Payload but the [PubSubMessage in Google 
Cloud](http://googleapis.github.io/googleapis/java/proto-google-cloud-pubsub-v1/0.1.19/apidocs/com/google/pubsub/v1/PubsubMessage.html?is-external=true)
 exposes a lot more information like `getPublishTime()`.

Is there a way for us to get the same amount information in Beam easily?
--
Derek Hao Hu

Software Engineer | Snapchat
Snap Inc.

Reply via email to