Files
stream-applications/applications/source/rabbit-source
2021-06-07 18:54:32 -04:00
..
2021-06-07 18:54:32 -04:00
2021-06-04 11:37:32 -04:00
2021-06-04 11:37:32 -04:00

//tag::ref-doc[]
= 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

=== Payload

* `byte[]`

== Options

The **$$rabbit$$** $$source$$ has the following options:

//tag::configuration-properties[]
Properties grouped by prefix:


=== rabbit.supplier

$$enable-retry$$:: $$true to enable retry.$$ *($$Boolean$$, default: `$$false$$`)*
$$initial-retry-interval$$:: $$Initial retry interval when retry is enabled.$$ *($$Integer$$, default: `$$1000$$`)*
$$mapped-request-headers$$:: $$Headers that will be mapped.$$ *($$String[]$$, default: `$$[STANDARD_REQUEST_HEADERS]$$`)*
$$max-attempts$$:: $$The maximum delivery attempts when retry is enabled.$$ *($$Integer$$, default: `$$3$$`)*
$$max-retry-interval$$:: $$Max retry interval when retry is enabled.$$ *($$Integer$$, default: `$$30000$$`)*
$$own-connection$$:: $$When true, use a separate connection based on the boot properties.$$ *($$Boolean$$, default: `$$false$$`)*
$$queues$$:: $$The queues to which the source will listen for messages.$$ *($$String[]$$, default: `$$<none>$$`)*
$$requeue$$:: $$Whether rejected messages should be requeued.$$ *($$Boolean$$, default: `$$true$$`)*
$$retry-multiplier$$:: $$Retry backoff multiplier when retry is enabled.$$ *($$Double$$, default: `$$2$$`)*
$$transacted$$:: $$Whether the channel is transacted.$$ *($$Boolean$$, default: `$$false$$`)*

=== spring.rabbitmq

$$address-shuffle-mode$$:: $$Mode used to shuffle configured addresses.$$ *($$AddressShuffleMode$$, default: `$$none$$`, possible values: `NONE`,`RANDOM`,`INORDER`)*
$$addresses$$:: $$Comma-separated list of addresses to which the client should connect. When set, the host and port are ignored.$$ *($$String$$, default: `$$<none>$$`)*
$$channel-rpc-timeout$$:: $$Continuation timeout for RPC calls in channels. Set it to zero to wait forever.$$ *($$Duration$$, default: `$$10m$$`)*
$$connection-timeout$$:: $$Connection timeout. Set it to zero to wait forever.$$ *($$Duration$$, default: `$$<none>$$`)*
$$host$$:: $$RabbitMQ host. Ignored if an address is set.$$ *($$String$$, default: `$$localhost$$`)*
$$password$$:: $$Login to authenticate against the broker.$$ *($$String$$, default: `$$guest$$`)*
$$port$$:: $$RabbitMQ port. Ignored if an address is set. Default to 5672, or 5671 if SSL is enabled.$$ *($$Integer$$, default: `$$<none>$$`)*
$$publisher-confirm-type$$:: $$Type of publisher confirms to use.$$ *($$ConfirmType$$, default: `$$<none>$$`, possible values: `SIMPLE`,`CORRELATED`,`NONE`)*
$$publisher-returns$$:: $$Whether to enable publisher returns.$$ *($$Boolean$$, default: `$$false$$`)*
$$requested-channel-max$$:: $$Number of channels per connection requested by the client. Use 0 for unlimited.$$ *($$Integer$$, default: `$$2047$$`)*
$$requested-heartbeat$$:: $$Requested heartbeat timeout; zero for none. If a duration suffix is not specified, seconds will be used.$$ *($$Duration$$, default: `$$<none>$$`)*
$$username$$:: $$Login user to authenticate to the broker.$$ *($$String$$, default: `$$guest$$`)*
$$virtual-host$$:: $$Virtual host to use when connecting to the broker.$$ *($$String$$, default: `$$<none>$$`)*
//end::configuration-properties[]

Also see the https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html[Spring Boot Documentation]
for addition properties for the broker connections and listener properties.

[[rabbitSourceRetry]]
=== 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=
```

//end::ref-doc[]