com.google.cloud.dataflow.sdk.io

## 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>>

A `PTransform` that reads from a Cloud Pub/Sub source and returns a unbounded `PCollection` containing the items from the stream.

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`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
`PCollection<T>` `apply(PInput input)` Applies this `PTransform` on the given `InputT`, and returns its `Output`.
`Coder<T>` `getCoder()`
`protected Coder<T>` `getDefaultOutputCoder()` Returns the default `Coder` to use for the output of this single-output `PTransform`.
`String` `getIdLabel()`
`int` `getMaxNumRecords()`
`Duration` `getMaxReadTime()`
`PubsubIO.PubsubSubscription` `getSubscription()`
`String` `getTimestampLabel()`
`PubsubIO.PubsubTopic` `getTopic()`
`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>` `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.
`<X> PubsubIO.Read.Bound<X>` `withCoder(Coder<X> coder)` Returns a transform that's like this one but that uses the given `Coder` to decode each record into a value of type `X`.

### Methods inherited from class com.google.cloud.dataflow.sdk.transforms.PTransform

`getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, toString, validate`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### 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 the `subscription` 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.

#### 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 the `topic` string.

Does not modify this object.

#### 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. See `PubsubIO.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. See `PubsubIO.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 given `Coder` to decode each record into a value of type `X`.

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 bounded `PCollection`. See `PubsubIO.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 bounded `PCollection`. See `PubsubIO.Read.maxReadTime(Duration)` for more details.

#### apply

    public PCollection<T> apply(PInput input)

Description copied from class: `PTransform`
Applies this `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).

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 class `PTransform<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 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.

Specified by:
  `populateDisplayData` in interface `HasDisplayData`
Overrides:
  `populateDisplayData` in class `PTransform<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 default `Coder` to use for the output of this single-output `PTransform`.

By default, always throws

Overrides:
  `getDefaultOutputCoder` in class `PTransform<PInput,PCollection<T>>`

#### getTopic

    public PubsubIO.PubsubTopic getTopic()

#### getSubscription

    public PubsubIO.PubsubSubscription getSubscription()

#### getTimestampLabel

    public String getTimestampLabel()

#### getCoder

    public Coder<T> getCoder()

#### getIdLabel

    public String getIdLabel()

#### getMaxNumRecords

    public int getMaxNumRecords()

#### getMaxReadTime

    public Duration getMaxReadTime()