Google Cloud Dataflow SDK for Java, version 1.9.1
Class PubsubIO.Read.Bound<T>
- java.lang.Object
-
- com.google.cloud.dataflow.sdk.transforms.PTransform<PInput,PCollection<T>>
-
- com.google.cloud.dataflow.sdk.io.PubsubIO.Read.Bound<T>
-
- All Implemented Interfaces:
- HasDisplayData, Serializable
- Enclosing class:
- PubsubIO.Read
public static class PubsubIO.Read.Bound<T> extends PTransform<PInput,PCollection<T>>
APTransform
that reads from a Cloud Pub/Sub source and returns a unboundedPCollection
containing the items from the stream.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description class
PubsubIO.Read.Bound.PubsubReader
Default reader when Pubsub subscription has some form of upper bound.
-
Field Summary
-
Fields inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
name
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PCollection<T>
apply(PInput input)
Applies thisPTransform
on the givenInputT
, and returns itsOutput
.Coder<T>
getCoder()
protected Coder<T>
getDefaultOutputCoder()
Returns the defaultCoder
to use for the output of this single-outputPTransform
.String
getIdLabel()
int
getMaxNumRecords()
Duration
getMaxReadTime()
PubsubIO.PubsubSubscription
getSubscription()
ValueProvider<PubsubIO.PubsubSubscription>
getSubscriptionProvider()
String
getTimestampLabel()
PubsubIO.PubsubTopic
getTopic()
ValueProvider<PubsubIO.PubsubTopic>
getTopicProvider()
PubsubIO.Read.Bound<T>
idLabel(String idLabel)
Returns a transform that's like this one but that reads unique message IDs from the given message attribute.PubsubIO.Read.Bound<T>
maxNumRecords(int maxNumRecords)
Returns a transform that's like this one but will only read up to the specified maximum number of records from Cloud Pub/Sub.PubsubIO.Read.Bound<T>
maxReadTime(Duration maxReadTime)
Returns a transform that's like this one but will only read during the specified duration from Cloud Pub/Sub.PubsubIO.Read.Bound<T>
named(String name)
Returns a transform that's like this one but with the given step name.void
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.PubsubIO.Read.Bound<T>
subscription(String subscription)
Returns a transform that's like this one but reading from the given subscription.PubsubIO.Read.Bound<T>
subscription(ValueProvider<String> subscription)
Likesubscription()
but with aValueProvider
.PubsubIO.Read.Bound<T>
timestampLabel(String timestampLabel)
Returns a transform that's like this one but that reads message timestamps from the given message attribute.PubsubIO.Read.Bound<T>
topic(String topic)
Returns a transform that's like this one but that reads from the specified topic.PubsubIO.Read.Bound<T>
topic(ValueProvider<String> topic)
Liketopic()
but with aValueProvider
.<X> PubsubIO.Read.Bound<X>
withCoder(Coder<X> coder)
Returns a transform that's like this one but that uses the givenCoder
to decode each record into a value of typeX
.-
Methods inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform
getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, toString, validate
-
-
-
-
Method Detail
-
named
public PubsubIO.Read.Bound<T> named(String name)
Returns a transform that's like this one but with the given step name.Does not modify this object.
-
subscription
public PubsubIO.Read.Bound<T> subscription(String subscription)
Returns a transform that's like this one but reading from the given subscription.See
PubsubIO.PubsubSubscription.fromPath(String)
for more details on the format of thesubscription
string.Multiple readers reading from the same subscription will each receive some arbitrary portion of the data. Most likely, separate readers should use their own subscriptions.
Does not modify this object.
-
subscription
public PubsubIO.Read.Bound<T> subscription(ValueProvider<String> subscription)
Likesubscription()
but with aValueProvider
.
-
topic
public PubsubIO.Read.Bound<T> topic(String topic)
Returns a transform that's like this one but that reads from the specified topic.See
PubsubIO.PubsubTopic.fromPath(String)
for more details on the format of thetopic
string.Does not modify this object.
-
topic
public PubsubIO.Read.Bound<T> topic(ValueProvider<String> topic)
Liketopic()
but with aValueProvider
.
-
timestampLabel
public PubsubIO.Read.Bound<T> timestampLabel(String timestampLabel)
Returns a transform that's like this one but that reads message timestamps from the given message attribute. SeePubsubIO.Read.timestampLabel(String)
for more details on the format of the timestamp attribute.Does not modify this object.
-
idLabel
public PubsubIO.Read.Bound<T> idLabel(String idLabel)
Returns a transform that's like this one but that reads unique message IDs from the given message attribute. SeePubsubIO.Read.idLabel(String)
for more details on the format of the ID attribute.Does not modify this object.
-
withCoder
public <X> PubsubIO.Read.Bound<X> withCoder(Coder<X> coder)
Returns a transform that's like this one but that uses the givenCoder
to decode each record into a value of typeX
.Does not modify this object.
- Type Parameters:
X
- the type of the decoded elements, and the elements of the resulting PCollection.
-
maxNumRecords
public PubsubIO.Read.Bound<T> maxNumRecords(int maxNumRecords)
Returns a transform that's like this one but will only read up to the specified maximum number of records from Cloud Pub/Sub. The transform produces a boundedPCollection
. SeePubsubIO.Read.maxNumRecords(int)
for more details.
-
maxReadTime
public PubsubIO.Read.Bound<T> maxReadTime(Duration maxReadTime)
Returns a transform that's like this one but will only read during the specified duration from Cloud Pub/Sub. The transform produces a boundedPCollection
. SeePubsubIO.Read.maxReadTime(Duration)
for more details.
-
apply
public PCollection<T> apply(PInput input)
Description copied from class:PTransform
Applies thisPTransform
on the givenInputT
, and returns itsOutput
.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)
.- Overrides:
apply
in classPTransform<PInput,PCollection<T>>
-
populateDisplayData
public void populateDisplayData(DisplayData.Builder builder)
Description copied from class:PTransform
Register display data for the given transform or component.populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData)
. Implementations may callsuper.populateDisplayData(builder)
in order to register display data in the current namespace, but should otherwise usesubcomponent.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.
- Specified by:
populateDisplayData
in interfaceHasDisplayData
- Overrides:
populateDisplayData
in classPTransform<PInput,PCollection<T>>
- Parameters:
builder
- The builder to populate with display data.- See Also:
HasDisplayData
-
getDefaultOutputCoder
protected Coder<T> getDefaultOutputCoder()
Description copied from class:PTransform
Returns the defaultCoder
to use for the output of this single-outputPTransform
.By default, always throws
- Overrides:
getDefaultOutputCoder
in classPTransform<PInput,PCollection<T>>
-
getTopic
public PubsubIO.PubsubTopic getTopic()
-
getTopicProvider
public ValueProvider<PubsubIO.PubsubTopic> getTopicProvider()
-
getSubscription
public PubsubIO.PubsubSubscription getSubscription()
-
getSubscriptionProvider
public ValueProvider<PubsubIO.PubsubSubscription> getSubscriptionProvider()
-
getTimestampLabel
public String getTimestampLabel()
-
getIdLabel
public String getIdLabel()
-
getMaxNumRecords
public int getMaxNumRecords()
-
getMaxReadTime
public Duration getMaxReadTime()
-
-