public abstract static class RabbitMqIO.Read extends PTransform<PBegin,PCollection<RabbitMqMessage>>
PTransform
to consume messages from RabbitMQ server.name
Constructor and Description |
---|
Read() |
Modifier and Type | Method and Description |
---|---|
PCollection<RabbitMqMessage> |
expand(PBegin input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
RabbitMqIO.Read |
withExchange(java.lang.String name,
java.lang.String routingKey)
In AMQP, messages are published to an exchange and routed to queues based on the exchange
type and a queue binding.
|
RabbitMqIO.Read |
withExchange(java.lang.String name,
java.lang.String type,
java.lang.String routingKey)
In AMQP, messages are published to an exchange and routed to queues based on the exchange
type and a queue binding.
|
RabbitMqIO.Read |
withMaxNumRecords(long maxNumRecords)
Define the max number of records received by the
RabbitMqIO.Read . |
RabbitMqIO.Read |
withMaxReadTime(Duration maxReadTime)
Define the max read time (duration) while the
RabbitMqIO.Read will receive messages. |
RabbitMqIO.Read |
withQueue(java.lang.String queue)
If you want to directly consume messages from a specific queue, you just have to specify the
queue name.
|
RabbitMqIO.Read |
withQueueDeclare(boolean queueDeclare)
You can "force" the declaration of a queue on the RabbitMQ broker.
|
RabbitMqIO.Read |
withUri(java.lang.String uri) |
RabbitMqIO.Read |
withUseCorrelationId(boolean useCorrelationId)
Toggles deduplication of messages based on the amqp correlation-id property on incoming
messages.
|
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate
public RabbitMqIO.Read withUri(java.lang.String uri)
public RabbitMqIO.Read withQueue(java.lang.String queue)
withQueueDeclare(boolean)
.public RabbitMqIO.Read withQueueDeclare(boolean queueDeclare)
NOTE: When declaring a queue or exchange that already exists, the properties specified in the declaration must match those of the existing queue or exchange. That is, if you declare a queue to be non-durable but a durable queue already exists with the same name, the declaration will fail. When declaring a queue, RabbitMqIO will declare it to be non-durable.
queueDeclare
- If true
, RabbitMqIO
will declare a non-durable queue. If
another application created the queue, this is not required and should be set to false
public RabbitMqIO.Read withExchange(java.lang.String name, java.lang.String type, @Nullable java.lang.String routingKey)
This function should be used if the Beam pipeline will be responsible for declaring the
exchange. As a result of calling this function, exchangeDeclare
will be set to true
and the resulting exchange will be non-durable and of the supplied type. If an exchange
with the given name already exists but is durable or is of another type, exchange declaration
will fail.
To use an exchange without declaring it, especially for cases when the exchange is shared
with other applications or already exists, use withExchange(String, String)
instead.
public RabbitMqIO.Read withExchange(java.lang.String name, @Nullable java.lang.String routingKey)
This function should be used if the Beam pipeline will be using an exchange that has
already been declared or when using an exchange shared by other applications, such as an
events bus or pubsub. As a result of calling this function, exchangeDeclare
will be
set to false
.
public RabbitMqIO.Read withMaxNumRecords(long maxNumRecords)
RabbitMqIO.Read
. When this max number of
records is lower than Long.MAX_VALUE
, the RabbitMqIO.Read
will provide a bounded PCollection
.public RabbitMqIO.Read withMaxReadTime(Duration maxReadTime)
RabbitMqIO.Read
will receive messages. When this
max read time is not null, the RabbitMqIO.Read
will provide a bounded PCollection
.public RabbitMqIO.Read withUseCorrelationId(boolean useCorrelationId)
When set to true
all read messages will require the amqp correlation-id property
to be set.
When set to false
the correlation-id property will not be used by the Reader and
no automatic deduplication will occur.
public PCollection<RabbitMqMessage> 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<RabbitMqMessage>>