public abstract static class PubsubIO.Write<T> extends PTransform<PCollection<T>,PDone>
PubsubIO.write()
.Modifier and Type | Class and Description |
---|---|
static class |
PubsubIO.Write.External
Exposes
PubSubIO.Write as an external transform for cross-language usage. |
class |
PubsubIO.Write.PubsubBoundedWriter
Writer to Pubsub which batches messages from bounded collections.
|
name
Constructor and Description |
---|
Write() |
Modifier and Type | Method and Description |
---|---|
PDone |
expand(PCollection<T> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
PubsubIO.Write<T> |
to(java.lang.String topic)
Publishes to the specified topic.
|
PubsubIO.Write<T> |
to(ValueProvider<java.lang.String> topic)
Like
topic() but with a ValueProvider . |
PubsubIO.Write<T> |
withClientFactory(PubsubClient.PubsubClientFactory factory)
The default client to write to Pub/Sub is the
PubsubJsonClient , created by the PubsubJsonClient.PubsubJsonClientFactory . |
PubsubIO.Write<T> |
withIdAttribute(java.lang.String idAttribute)
Writes to Pub/Sub, adding each record's unique identifier to the published messages in an
attribute with the specified name.
|
PubsubIO.Write<T> |
withMaxBatchBytesSize(int maxBatchBytesSize)
Writes to Pub/Sub are limited by 10mb in general.
|
PubsubIO.Write<T> |
withMaxBatchSize(int batchSize)
Writes to Pub/Sub are batched to efficiently send data.
|
PubsubIO.Write<T> |
withTimestampAttribute(java.lang.String timestampAttribute)
Writes to Pub/Sub and adds each record's timestamp to the published messages in an attribute
with the specified name.
|
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, toString, validate
public PubsubIO.Write<T> to(java.lang.String topic)
See PubsubIO.PubsubTopic.fromPath(String)
for more details on the format of the
topic
string.
public PubsubIO.Write<T> to(ValueProvider<java.lang.String> topic)
topic()
but with a ValueProvider
.public PubsubIO.Write<T> withClientFactory(PubsubClient.PubsubClientFactory factory)
PubsubJsonClient
, created by the PubsubJsonClient.PubsubJsonClientFactory
. This function allows to change the Pub/Sub client
by providing another PubsubClient.PubsubClientFactory
like the PubsubGrpcClientFactory
.public PubsubIO.Write<T> withMaxBatchSize(int batchSize)
Pub/Sub has a limitation of 10mb per individual request/batch. This attribute was requested dynamic to allow larger Pub/Sub messages to be sent using this source. Thus allowing customizable batches and control of number of events before the 10mb size limit is hit.
public PubsubIO.Write<T> withMaxBatchBytesSize(int maxBatchBytesSize)
public PubsubIO.Write<T> withTimestampAttribute(java.lang.String timestampAttribute)
Instant.Instant(long)
can be used to parse this value.
If the output from this sink is being read by another Beam pipeline, then PubsubIO.Read.withTimestampAttribute(String)
can be used to ensure the other source reads
these timestamps from the appropriate attribute.
public PubsubIO.Write<T> withIdAttribute(java.lang.String idAttribute)
If the the output from this sink is being read by another Beam pipeline, then PubsubIO.Read.withIdAttribute(String)
can be used to ensure that* the other source reads
these unique identifiers from the appropriate attribute.
public PDone expand(PCollection<T> input)
PTransform
PTransform
should be expanded on the given
InputT
.
NOTE: This method should not be called directly. Instead apply the PTransform
should
be applied to the InputT
using the apply
method.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
expand
in class PTransform<PCollection<T>,PDone>
public void populateDisplayData(DisplayData.Builder builder)
PTransform
populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect
display data via DisplayData.from(HasDisplayData)
. Implementations may call super.populateDisplayData(builder)
in order to register display data in the current namespace,
but should otherwise use subcomponent.populateDisplayData(builder)
to use the namespace
of the subcomponent.
By default, does not register any display data. Implementors may override this method to provide their own display data.
populateDisplayData
in interface HasDisplayData
populateDisplayData
in class PTransform<PCollection<T>,PDone>
builder
- The builder to populate with display data.HasDisplayData