A lot of the documentation for the Google Cloud Platform for Java SDK 2.x tell you to reference Beam documentation.
When reading from PubSub using Dataflow, should I still be doing PubsubIO.Read.named("name").topic("");
Or should I be doing something else?
Also building off of that, is there a way to just print PubSub data received by the Dataflow to standard output or to a file?
Adding to what Adrew wrote above. Code to read strings from PubSubIO and write them to stdout (just for debugging) is below. That said, I will file internal bug to improve JavaDoc for PubsubIO, I think the current documentation is minimal.
For Apache Beam 2.2.0, you can define the following transform to pull messages from a Pub/Sub subscription:
This is one way to define a transform that will pull messages from Pub/Sub. However, the
PubsubIO
class contains different methods for pulling messages. Each method has slightly different functionality. See the PubsubIO documentation.You can write the Pub/Sub messages to a file using the
TextIO
class. See the examples in the TextIO documentation. See the Logging Pipeline Messages documentation for writing Pub/Sub messages tostdout
.