This connector provides access to data streams from RabbitMQ. To use this connector, add the following dependency to your project:
Note that the streaming connectors are currently not part of the binary distribution. See linking with them for cluster execution here.
Installing RabbitMQ
Follow the instructions from the RabbitMQ download page. After the installation the server automatically starts, and the application connecting to RabbitMQ can be launched.
RabbitMQ Source
A class which provides an interface for receiving data from RabbitMQ.
The followings have to be provided for the RMQSource(…) constructor in order:
RMQConnectionConfig.
queueName: The RabbitMQ queue name.
usesCorrelationId: true when correlation ids should be used, false otherwise (default is false).
deserializationSchema: Deserialization schema to turn messages into Java objects.
This source can be operated in three different modes:
Exactly-once (when checkpointed) with RabbitMQ transactions and messages with
unique correlation IDs.
At-least-once (when checkpointed) with RabbitMQ transactions but no deduplication mechanism
(correlation id is not set).
No strong delivery guarantees (without checkpointing) with RabbitMQ auto-commit mode.
Correlation ids are a RabbitMQ application feature. You have to set it in the message properties
when injecting messages into RabbitMQ. If you set usesCorrelationId to true and do not supply
unique correlation ids, the source will throw an exception (if the correlation id is null) or ignore
messages with non-unique correlation ids. If you set usesCorrelationId to false, then you don’t
have to supply correlation ids.
Example:
RabbitMQ Sink
A class providing an interface for sending data to RabbitMQ.
The followings have to be provided for the RMQSink(…) constructor in order: