Google Cloud Dataflow SDK for Java, version 1.9.1
Class PubsubIO.Write
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.io.PubsubIO.Write
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
PubsubIO.Write.Bound<T>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static PubsubIO.Write.Bound<String>
idLabel(String idLabel)
Creates a transform that writes to Pub/Sub, adding each record's unique identifier to the published messages in an attribute with the specified name.static PubsubIO.Write.Bound<String>
named(String name)
Creates a transform that writes to Pub/Sub with the given step name.static PubsubIO.Write.Bound<String>
timestampLabel(String timestampLabel)
Creates a transform that writes to Pub/Sub, adds each record's timestamp to the published messages in an attribute with the specified name.static PubsubIO.Write.Bound<String>
topic(String topic)
Creates a transform that publishes to the specified topic.static PubsubIO.Write.Bound<String>
topic(ValueProvider<String> topic)
Liketopic()
but with aValueProvider
.static <T> PubsubIO.Write.Bound<T>
withCoder(Coder<T> coder)
Creates a transform that uses the givenCoder
to encode each of the elements of the input collection into an output message.
-
-
-
Method Detail
-
named
public static PubsubIO.Write.Bound<String> named(String name)
Creates a transform that writes to Pub/Sub with the given step name.
-
topic
public static PubsubIO.Write.Bound<String> topic(String topic)
Creates a transform that publishes to the specified topic.See
PubsubIO.PubsubTopic.fromPath(String)
for more details on the format of thetopic
string.
-
topic
public static PubsubIO.Write.Bound<String> topic(ValueProvider<String> topic)
Liketopic()
but with aValueProvider
.
-
timestampLabel
public static PubsubIO.Write.Bound<String> timestampLabel(String timestampLabel)
Creates a transform that writes to Pub/Sub, adds each record's timestamp to the published messages in an attribute with the specified name. The value of the attribute will be a number representing the number of milliseconds since the Unix epoch. For example, if using the Joda time classes,Instant.Instant(long)
can be used to parse this value.If the output from this sink is being read by another Dataflow source, then
PubsubIO.Read.timestampLabel(String)
can be used to ensure the other source reads these timestamps from the appropriate attribute.
-
idLabel
public static PubsubIO.Write.Bound<String> idLabel(String idLabel)
Creates a transform that writes to Pub/Sub, adding each record's unique identifier to the published messages in an attribute with the specified name. The value of the attribute is an opaque string.If the the output from this sink is being read by another Dataflow source, then
PubsubIO.Read.idLabel(String)
can be used to ensure that* the other source reads these unique identifiers from the appropriate attribute.
-
withCoder
public static <T> PubsubIO.Write.Bound<T> withCoder(Coder<T> coder)
Creates a transform that uses the givenCoder
to encode each of the elements of the input collection into an output message.By default, uses
StringUtf8Coder
, which writes input Java strings directly as records.- Type Parameters:
T
- the type of the elements of the input PCollection
-
-