public class PubsubUnboundedSource extends PTransform<PBegin,PCollection<PubsubMessage>>
PubsubIO.read()
instead.
A PTransform which streams messages from Pubsub.
UnboundedSource
which receives messages
in batches and hands them out one at a time.
UnboundedSource.UnboundedReader
instances to execute concurrently and thus hide latency.
name
Constructor and Description |
---|
PubsubUnboundedSource(PubsubClient.PubsubClientFactory pubsubFactory,
ValueProvider<org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.ProjectPath> project,
ValueProvider<PubsubClient.TopicPath> topic,
ValueProvider<PubsubClient.SubscriptionPath> subscription,
java.lang.String timestampAttribute,
java.lang.String idAttribute,
boolean needsAttributes)
Construct an unbounded source to consume from the Pubsub
subscription . |
Modifier and Type | Method and Description |
---|---|
PCollection<PubsubMessage> |
expand(PBegin input)
Applies this
PTransform on the given InputT , and returns its
Output . |
java.lang.String |
getIdAttribute()
Get the id attribute.
|
boolean |
getNeedsAttributes() |
org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.ProjectPath |
getProject()
Get the project path.
|
PubsubClient.SubscriptionPath |
getSubscription()
Get the subscription being read from.
|
ValueProvider<PubsubClient.SubscriptionPath> |
getSubscriptionProvider()
Get the
ValueProvider for the subscription being read from. |
java.lang.String |
getTimestampAttribute()
Get the timestamp attribute.
|
PubsubClient.TopicPath |
getTopic()
Get the topic being read from.
|
ValueProvider<PubsubClient.TopicPath> |
getTopicProvider()
Get the
ValueProvider for the topic being read from. |
getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate
public PubsubUnboundedSource(PubsubClient.PubsubClientFactory pubsubFactory, @Nullable ValueProvider<org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.ProjectPath> project, @Nullable ValueProvider<PubsubClient.TopicPath> topic, @Nullable ValueProvider<PubsubClient.SubscriptionPath> subscription, @Nullable java.lang.String timestampAttribute, @Nullable java.lang.String idAttribute, boolean needsAttributes)
subscription
.@Nullable public org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.ProjectPath getProject()
@Nullable public PubsubClient.TopicPath getTopic()
@Nullable public ValueProvider<PubsubClient.TopicPath> getTopicProvider()
ValueProvider
for the topic being read from.@Nullable public PubsubClient.SubscriptionPath getSubscription()
@Nullable public ValueProvider<PubsubClient.SubscriptionPath> getSubscriptionProvider()
ValueProvider
for the subscription being read from.@Nullable public java.lang.String getTimestampAttribute()
@Nullable public java.lang.String getIdAttribute()
public boolean getNeedsAttributes()
public PCollection<PubsubMessage> expand(PBegin input)
PTransform
PTransform
on the given InputT
, and returns its
Output
.
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<PBegin,PCollection<PubsubMessage>>