public static class PubsubIO.Write extends Object
PTransform that continuously writes a
PCollection<String> to a Pubsub stream.| Modifier and Type | Class and Description |
|---|---|
static class |
PubsubIO.Write.Bound<T>
A
PTransform that writes an unbounded PCollection<String>
to a PubSub stream. |
| Constructor and Description |
|---|
Write() |
| Modifier and Type | Method and Description |
|---|---|
static PubsubIO.Write.Bound<String> |
idLabel(String idLabel)
If specified, Dataflow will add a Pubsub label to each output record containing a unique
identifier for that record.
|
static PubsubIO.Write.Bound<String> |
named(String name) |
static PubsubIO.Write.Bound<String> |
timestampLabel(String timestampLabel)
If specified, Dataflow will add a Pubsub label to each output record specifying the logical
timestamp of the record.
|
static PubsubIO.Write.Bound<String> |
topic(String topic)
The topic to publish to.
|
static <T> PubsubIO.Write.Bound<T> |
withCoder(Coder<T> coder)
Returns a TextIO.Write PTransform that uses the given
Coder<T> to encode each of the elements of the input
PCollection<T> into an output PubSub record. |
public static PubsubIO.Write.Bound<String> named(String name)
public static PubsubIO.Write.Bound<String> topic(String topic)
/topics/<project>/<topic>,
where <project> is the name of the publishing project.public static PubsubIO.Write.Bound<String> timestampLabel(String timestampLabel)
<timestampLabel> determines the label name. The label value
is a numerical value representing the number of milliseconds since the Unix epoch. For
example, if using the joda time classes, the org.joda.time.Instant(long) constructor can be
used to parse this value. If the output from this sink is being read by another Dataflow
source, then PubsubIO.Read.timestampLabel can be used to ensure that the other source reads
these timestamps from the appropriate label.public static PubsubIO.Write.Bound<String> idLabel(String idLabel)
<idLabel> determines the label name. The label value
is an opaque string value. This is useful if the the output from this sink is being read
by another Dataflow source, in which case PubsubIO.Read.idLabel can be used to ensure that
the other source reads these ids from the appropriate label.public static <T> PubsubIO.Write.Bound<T> withCoder(Coder<T> coder)
Coder<T> to encode each of the elements of the input
PCollection<T> into an output PubSub record.
By default, uses StringUtf8Coder, which writes input
Java strings directly as records.
T - the type of the elements of the input PCollection