Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.

Latest commit

 

History

History
103 lines (76 loc) · 4.6 KB

File metadata and controls

103 lines (76 loc) · 4.6 KB

RabbitMQ Source

The "rabbit" source enables receiving messages from RabbitMQ.

The queue(s) must exist before the stream is deployed; they are not created automatically. You can easily create a Queue using the RabbitMQ web UI.

Input

N/A

Output

Headers

  • content-type: text/plain

Payload

  • String

Headers

  • content-type: application/octet-stream

Payload

  • byte[]

Headers

  • content-type: application/x-java-serialized-object

Payload

  • java.io.Serializable

Options

The rabbit source has the following options:

rabbit.enable-retry

true to enable retry. (Boolean, default: false)

rabbit.initial-retry-interval

Initial retry interval when retry is enabled. (Integer, default: 1000)

rabbit.mapped-request-headers

Headers that will be mapped. (String[], default: [STANDARD_REQUEST_HEADERS])

rabbit.max-attempts

The maximum delivery attempts when retry is enabled. (Integer, default: 3)

rabbit.max-retry-interval

Max retry interval when retry is enabled. (Integer, default: 30000)

rabbit.own-connection

When true, use a separate connection based on the boot properties. (Boolean, default: false)

rabbit.queues

The queues to which the source will listen for messages. (String[], default: <none>)

rabbit.requeue

Whether rejected messages should be requeued. (Boolean, default: true)

rabbit.retry-multiplier

Retry backoff multiplier when retry is enabled. (Double, default: 2)

rabbit.transacted

Whether the channel is transacted. (Boolean, default: false)

spring.rabbitmq.addresses

Comma-separated list of addresses to which the client should connect. (String, default: <none>)

spring.rabbitmq.connection-timeout

Connection timeout. Set it to zero to wait forever. (Duration, default: <none>)

spring.rabbitmq.host

RabbitMQ host. (String, default: localhost)

spring.rabbitmq.password

Login to authenticate against the broker. (String, default: guest)

spring.rabbitmq.port

RabbitMQ port. (Integer, default: 5672)

spring.rabbitmq.publisher-confirms

Whether to enable publisher confirms. (Boolean, default: false)

spring.rabbitmq.publisher-returns

Whether to enable publisher returns. (Boolean, default: false)

spring.rabbitmq.requested-heartbeat

Requested heartbeat timeout; zero for none. If a duration suffix is not specified, seconds will be used. (Duration, default: <none>)

spring.rabbitmq.username

Login user to authenticate to the broker. (String, default: guest)

spring.rabbitmq.virtual-host

Virtual host to use when connecting to the broker. (String, default: <none>)

Also see the Spring Boot Documentation for addition properties for the broker connections and listener properties.

A Note About Retry

Note
With the default ackMode (AUTO) and requeue (true) options, failed message deliveries will be retried indefinitely. Since there is not much processing in the rabbit source, the risk of failure in the source itself is small, unless the downstream Binder is not connected for some reason. Setting requeue to false will cause messages to be rejected on the first attempt (and possibly sent to a Dead Letter Exchange/Queue if the broker is so configured). The enableRetry option allows configuration of retry parameters such that a failed message delivery can be retried and eventually discarded (or dead-lettered) when retries are exhausted. The delivery thread is suspended during the retry interval(s). Retry options are enableRetry, maxAttempts, initialRetryInterval, retryMultiplier, and maxRetryInterval. Message deliveries failing with a MessageConversionException are never retried; the assumption being that if a message could not be converted on the first attempt, subsequent attempts will also fail. Such messages are discarded (or dead-lettered).

Build

$ ./mvnw clean install -PgenerateApps
$ cd apps

You can find the corresponding binder based projects here. You can then cd into one of the folders and build it:

$ ./mvnw clean package

Examples

java -jar rabbit-source.jar --rabbit.queues=