public class PubsubUnboundedSource<T> extends PTransform<PBegin,PCollection<T>>
UnboundedSource which receives messages
in batches and hands them out one at a time.
UnboundedSource.UnboundedReader instances to execute concurrently and thus hide latency.
NOTE: This is not the implementation used when running on the Google Cloud Dataflow service.
name| Constructor and Description |
|---|
PubsubUnboundedSource(com.google.cloud.dataflow.sdk.util.PubsubClient.PubsubClientFactory pubsubFactory,
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.ProjectPath> project,
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.TopicPath> topic,
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.SubscriptionPath> subscription,
Coder<T> elementCoder,
String timestampLabel,
String idLabel)
Construct an unbounded source to consume from the Pubsub
subscription. |
| Modifier and Type | Method and Description |
|---|---|
PCollection<T> |
apply(PBegin input)
Applies this
PTransform on the given InputT, and returns its
Output. |
Coder<T> |
getElementCoder() |
String |
getIdLabel() |
com.google.cloud.dataflow.sdk.util.PubsubClient.ProjectPath |
getProject() |
com.google.cloud.dataflow.sdk.util.PubsubClient.SubscriptionPath |
getSubscription() |
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.SubscriptionPath> |
getSubscriptionProvider() |
String |
getTimestampLabel() |
com.google.cloud.dataflow.sdk.util.PubsubClient.TopicPath |
getTopic() |
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.TopicPath> |
getTopicProvider() |
getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validatepublic PubsubUnboundedSource(com.google.cloud.dataflow.sdk.util.PubsubClient.PubsubClientFactory pubsubFactory,
@Nullable
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.ProjectPath> project,
@Nullable
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.TopicPath> topic,
@Nullable
ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.SubscriptionPath> subscription,
Coder<T> elementCoder,
@Nullable
String timestampLabel,
@Nullable
String idLabel)
subscription.@Nullable public com.google.cloud.dataflow.sdk.util.PubsubClient.ProjectPath getProject()
@Nullable public com.google.cloud.dataflow.sdk.util.PubsubClient.TopicPath getTopic()
@Nullable public ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.TopicPath> getTopicProvider()
@Nullable public com.google.cloud.dataflow.sdk.util.PubsubClient.SubscriptionPath getSubscription()
@Nullable public ValueProvider<com.google.cloud.dataflow.sdk.util.PubsubClient.SubscriptionPath> getSubscriptionProvider()
public PCollection<T> apply(PBegin input)
PTransformPTransform 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).
The default implementation throws an exception. A derived class must
either implement apply, or else each runner must supply a custom
implementation via
PipelineRunner.apply(com.google.cloud.dataflow.sdk.transforms.PTransform<InputT, OutputT>, InputT).
apply in class PTransform<PBegin,PCollection<T>>