public class PubsubUnboundedSink extends PTransform<PCollection<PubsubMessage>,PDone>
GroupByKey
followed by a ParDo
which publishes as a side effect. (In the future we want to design and switch to a custom
UnboundedSink
implementation so as to gain access to system watermark and
end-of-pipeline cleanup.)
DoFn
instances to execute concurrently and hide latency.
name
Constructor and Description |
---|
PubsubUnboundedSink(PubsubClient.PubsubClientFactory pubsubFactory,
ValueProvider<PubsubClient.TopicPath> topic,
java.lang.String timestampAttribute,
java.lang.String idAttribute,
int numShards) |
PubsubUnboundedSink(PubsubClient.PubsubClientFactory pubsubFactory,
ValueProvider<PubsubClient.TopicPath> topic,
java.lang.String timestampAttribute,
java.lang.String idAttribute,
int numShards,
int publishBatchSize,
int publishBatchBytes) |
Modifier and Type | Method and Description |
---|---|
PDone |
expand(PCollection<PubsubMessage> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
java.lang.String |
getIdAttribute()
Get the id attribute.
|
java.lang.String |
getTimestampAttribute()
Get the timestamp attribute.
|
PubsubClient.TopicPath |
getTopic()
Get the topic being written to.
|
ValueProvider<PubsubClient.TopicPath> |
getTopicProvider()
Get the
ValueProvider for the topic being written to. |
getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate
public PubsubUnboundedSink(PubsubClient.PubsubClientFactory pubsubFactory, ValueProvider<PubsubClient.TopicPath> topic, java.lang.String timestampAttribute, java.lang.String idAttribute, int numShards)
public PubsubUnboundedSink(PubsubClient.PubsubClientFactory pubsubFactory, ValueProvider<PubsubClient.TopicPath> topic, java.lang.String timestampAttribute, java.lang.String idAttribute, int numShards, int publishBatchSize, int publishBatchBytes)
public PubsubClient.TopicPath getTopic()
public ValueProvider<PubsubClient.TopicPath> getTopicProvider()
ValueProvider
for the topic being written to.@Nullable public java.lang.String getTimestampAttribute()
@Nullable public java.lang.String getIdAttribute()
public PDone expand(PCollection<PubsubMessage> 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<PubsubMessage>,PDone>