public abstract static class JmsIO.Read<T> extends PTransform<PBegin,PCollection<T>>
PTransform
to read from a JMS destination. See JmsIO
for more information on
usage and configuration.name, resourceHints
Constructor and Description |
---|
Read() |
Modifier and Type | Method and Description |
---|---|
PCollection<T> |
expand(PBegin input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
JmsIO.Read<T> |
withCoder(Coder<T> coder) |
JmsIO.Read<T> |
withConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
Specify the JMS connection factory to connect to the JMS broker.
|
JmsIO.Read<T> |
withMaxNumRecords(long maxNumRecords)
Define the max number of records that the source will read.
|
JmsIO.Read<T> |
withMaxReadTime(Duration maxReadTime)
Define the max read time that the source will read.
|
JmsIO.Read<T> |
withMessageMapper(JmsIO.MessageMapper<T> messageMapper) |
JmsIO.Read<T> |
withPassword(java.lang.String password)
Define the password to connect to the JMS broker (authenticated).
|
JmsIO.Read<T> |
withQueue(java.lang.String queue)
Specify the JMS queue destination name where to read messages from.
|
JmsIO.Read<T> |
withTopic(java.lang.String topic)
Specify the JMS topic destination name where to receive messages from.
|
JmsIO.Read<T> |
withUsername(java.lang.String username)
Define the username to connect to the JMS broker (authenticated).
|
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setResourceHints, toString, validate
public JmsIO.Read<T> withConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
For instance:
pipeline.apply(JmsIO.read().withConnectionFactory(myConnectionFactory)
connectionFactory
- The JMS ConnectionFactory
.JmsIO.Read
.public JmsIO.Read<T> withQueue(java.lang.String queue)
JmsIO.Read
acts as a consumer on the queue.
This method is exclusive with withTopic(String)
. The user has to
specify a destination: queue or topic.
For instance:
pipeline.apply(JmsIO.read().withQueue("my-queue")
queue
- The JMS queue name where to read messages from.JmsIO.Read
.public JmsIO.Read<T> withTopic(java.lang.String topic)
JmsIO.Read
acts as a subscriber on the topic.
This method is exclusive with withQueue(String)
. The user has to
specify a destination: queue or topic.
For instance:
pipeline.apply(JmsIO.read().withTopic("my-topic")
topic
- The JMS topic name.JmsIO.Read
.public JmsIO.Read<T> withUsername(java.lang.String username)
public JmsIO.Read<T> withPassword(java.lang.String password)
public JmsIO.Read<T> withMaxNumRecords(long maxNumRecords)
Long.MAX_VALUE
means the source will be Bounded
, and will stop
once the max number of records read is reached.
For instance:
pipeline.apply(JmsIO.read().withNumRecords(1000)
maxNumRecords
- The max number of records to read from the JMS destination.JmsIO.Read
.public JmsIO.Read<T> withMaxReadTime(Duration maxReadTime)
Bounded
, and will stop once the max read time is reached.
For instance:
pipeline.apply(JmsIO.read().withMaxReadTime(Duration.minutes(10))
maxReadTime
- The max read time duration.JmsIO.Read
.public JmsIO.Read<T> withMessageMapper(JmsIO.MessageMapper<T> messageMapper)
public JmsIO.Read<T> withCoder(Coder<T> coder)
public PCollection<T> expand(PBegin 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<PBegin,PCollection<T>>
public void populateDisplayData(DisplayData.Builder builder)
PTransform
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.
populateDisplayData
in interface HasDisplayData
populateDisplayData
in class PTransform<PBegin,PCollection<T>>
builder
- The builder to populate with display data.HasDisplayData