299 lines
11 KiB
Plaintext
299 lines
11 KiB
Plaintext
[[rabbitmq-consumer-properties]]
|
|
= RabbitMQ Consumer Properties
|
|
|
|
The following properties are available for Rabbit consumers only and must be prefixed with `spring.cloud.stream.rabbit.bindings.<channelName>.consumer.`.
|
|
|
|
However if the same set of properties needs to be applied to most bindings, to
|
|
avoid repetition, Spring Cloud Stream supports setting values for all channels,
|
|
in the format of `spring.cloud.stream.rabbit.default.<property>=<value>`.
|
|
|
|
Also, keep in mind that binding specific property will override its equivalent in the default.
|
|
|
|
acknowledgeMode::
|
|
The acknowledge mode.
|
|
+
|
|
Default: `AUTO`.
|
|
anonymousGroupPrefix::
|
|
When the binding has no `group` property, an anonymous, auto-delete queue is bound to the destination exchange.
|
|
The default naming stragegy for such queues results in a queue named `anonymous.<base64 representation of a UUID>`.
|
|
Set this property to change the prefix to something other than the default.
|
|
+
|
|
Default: `anonymous.`.
|
|
autoBindDlq::
|
|
Whether to automatically declare the DLQ and bind it to the binder DLX.
|
|
+
|
|
Default: `false`.
|
|
bindingRoutingKey::
|
|
The routing key with which to bind the queue to the exchange (if `bindQueue` is `true`).
|
|
Can be multiple keys - see `bindingRoutingKeyDelimiter`.
|
|
For partitioned destinations, `-<instanceIndex>` is appended to each key.
|
|
+
|
|
Default: `#`.
|
|
bindingRoutingKeyDelimiter::
|
|
When this is not null, 'bindingRoutingKey' is considered to be a list of keys delimited by this value; often a comma is used.
|
|
+
|
|
Default: `null`.
|
|
bindQueue::
|
|
Whether to declare the queue and bind it to the destination exchange.
|
|
Set it to `false` if you have set up your own infrastructure and have previously created and bound the queue.
|
|
+
|
|
Default: `true`.
|
|
consumerTagPrefix::
|
|
Used to create the consumer tag(s); will be appended by `#n` where `n` increments for each consumer created.
|
|
Example: `${spring.application.name}-${spring.cloud.stream.bindings.input.group}-${spring.cloud.stream.instance-index}`.
|
|
+
|
|
Default: none - the broker will generate random consumer tags.
|
|
containerType::
|
|
Select the type of listener container to be used.
|
|
See https://docs.spring.io/spring-amqp/reference/html/_reference.html#choose-container[Choosing a Container] in the Spring AMQP documentation for more information.
|
|
Also see <<rabbitmq-stream>>.
|
|
+
|
|
Default: `simple`
|
|
deadLetterQueueName::
|
|
The name of the DLQ
|
|
+
|
|
Default: `prefix+destination.dlq`
|
|
deadLetterExchange::
|
|
A DLX to assign to the queue.
|
|
Relevant only if `autoBindDlq` is `true`.
|
|
+
|
|
Default: 'prefix+DLX'
|
|
deadLetterExchangeType::
|
|
The type of the DLX to assign to the queue.
|
|
Relevant only if `autoBindDlq` is `true`.
|
|
+
|
|
Default: 'direct'
|
|
deadLetterRoutingKey::
|
|
A dead letter routing key to assign to the queue.
|
|
Relevant only if `autoBindDlq` is `true`.
|
|
+
|
|
Default: `destination`
|
|
declareDlx::
|
|
Whether to declare the dead letter exchange for the destination.
|
|
Relevant only if `autoBindDlq` is `true`.
|
|
Set to `false` if you have a pre-configured DLX.
|
|
+
|
|
Default: `true`.
|
|
declareExchange::
|
|
Whether to declare the exchange for the destination.
|
|
+
|
|
Default: `true`.
|
|
delayedExchange::
|
|
Whether to declare the exchange as a `Delayed Message Exchange`.
|
|
Requires the delayed message exchange plugin on the broker.
|
|
The `x-delayed-type` argument is set to the `exchangeType`.
|
|
+
|
|
Default: `false`.
|
|
dlqBindingArguments::
|
|
Arguments applied when binding the dlq to the dead letter exchange; used with `headers` `deadLetterExchangeType` to specify headers to match on.
|
|
For example `...dlqBindingArguments.x-match=any`, `...dlqBindingArguments.someHeader=someValue`.
|
|
+
|
|
Default: empty
|
|
dlqDeadLetterExchange::
|
|
If a DLQ is declared, a DLX to assign to that queue.
|
|
+
|
|
Default: `none`
|
|
dlqDeadLetterRoutingKey::
|
|
If a DLQ is declared, a dead letter routing key to assign to that queue.
|
|
+
|
|
Default: `none`
|
|
dlqExpires::
|
|
How long before an unused dead letter queue is deleted (in milliseconds).
|
|
+
|
|
Default: `no expiration`
|
|
dlqLazy::
|
|
Declare the dead letter queue with the `x-queue-mode=lazy` argument.
|
|
See https://www.rabbitmq.com/lazy-queues.html["`Lazy Queues`"].
|
|
Consider using a policy instead of this setting, because using a policy allows changing the setting without deleting the queue.
|
|
+
|
|
Default: `false`.
|
|
dlqMaxLength::
|
|
Maximum number of messages in the dead letter queue.
|
|
+
|
|
Default: `no limit`
|
|
dlqMaxLengthBytes::
|
|
Maximum number of total bytes in the dead letter queue from all messages.
|
|
+
|
|
Default: `no limit`
|
|
dlqMaxPriority::
|
|
Maximum priority of messages in the dead letter queue (0-255).
|
|
+
|
|
Default: `none`
|
|
dlqOverflowBehavior::
|
|
Action to take when `dlqMaxLength` or `dlqMaxLengthBytes` is exceeded; currently `drop-head` or `reject-publish` but refer to the RabbitMQ documentation.
|
|
+
|
|
Default: `none`
|
|
dlqQuorum.deliveryLimit::
|
|
When `quorum.enabled=true`, set a delivery limit after which the message is dropped or dead-lettered.
|
|
+
|
|
Default: none - broker default will apply.
|
|
dlqQuorum.enabled::
|
|
When true, create a quorum dead letter queue instead of a classic queue.
|
|
+
|
|
Default: false
|
|
dlqQuorum.initialGroupSize::
|
|
When `quorum.enabled=true`, set the initial quorum size.
|
|
+
|
|
Default: none - broker default will apply.
|
|
dlqSingleActiveConsumer::
|
|
Set to true to set the `x-single-active-consumer` queue property to true.
|
|
+
|
|
Default: `false`
|
|
dlqTtl::
|
|
Default time to live to apply to the dead letter queue when declared (in milliseconds).
|
|
+
|
|
Default: `no limit`
|
|
durableSubscription::
|
|
Whether the subscription should be durable.
|
|
Only effective if `group` is also set.
|
|
+
|
|
Default: `true`.
|
|
exchangeAutoDelete::
|
|
If `declareExchange` is true, whether the exchange should be auto-deleted (that is, removed after the last queue is removed).
|
|
+
|
|
Default: `true`.
|
|
exchangeDurable::
|
|
If `declareExchange` is true, whether the exchange should be durable (that is, it survives broker restart).
|
|
+
|
|
Default: `true`.
|
|
exchangeType::
|
|
The exchange type: `direct`, `fanout`, `headers` or `topic` for non-partitioned destinations and `direct`, headers or `topic` for partitioned destinations.
|
|
+
|
|
Default: `topic`.
|
|
exclusive::
|
|
Whether to create an exclusive consumer.
|
|
Concurrency should be 1 when this is `true`.
|
|
Often used when strict ordering is required but enabling a hot standby instance to take over after a failure.
|
|
See `recoveryInterval`, which controls how often a standby instance attempts to consume.
|
|
Consider using `singleActiveConsumer` instead when using RabbitMQ 3.8 or later.
|
|
+
|
|
Default: `false`.
|
|
expires::
|
|
How long before an unused queue is deleted (in milliseconds).
|
|
+
|
|
Default: `no expiration`
|
|
failedDeclarationRetryInterval::
|
|
The interval (in milliseconds) between attempts to consume from a queue if it is missing.
|
|
+
|
|
Default: 5000
|
|
[[spring-cloud-stream-rabbit-frame-max-headroom]]
|
|
frameMaxHeadroom::
|
|
The number of bytes to reserve for other headers when adding the stack trace to a DLQ message header.
|
|
All headers must fit within the `frame_max` size configured on the broker.
|
|
Stack traces can be large; if the size plus this property exceeds `frame_max` then the stack trace will be truncated.
|
|
A WARN log will be written; consider increasing the `frame_max` or reducing the stack trace by catching the exception and throwing one with a smaller stack trace.
|
|
+
|
|
Default: 20000
|
|
headerPatterns::
|
|
Patterns for headers to be mapped from inbound messages.
|
|
+
|
|
Default: `['*']` (all headers).
|
|
lazy::
|
|
Declare the queue with the `x-queue-mode=lazy` argument.
|
|
See https://www.rabbitmq.com/lazy-queues.html["`Lazy Queues`"].
|
|
Consider using a policy instead of this setting, because using a policy allows changing the setting without deleting the queue.
|
|
+
|
|
Default: `false`.
|
|
maxConcurrency::
|
|
The maximum number of consumers.
|
|
Not supported when the `containerType` is `direct`.
|
|
+
|
|
Default: `1`.
|
|
maxLength::
|
|
The maximum number of messages in the queue.
|
|
+
|
|
Default: `no limit`
|
|
maxLengthBytes::
|
|
The maximum number of total bytes in the queue from all messages.
|
|
+
|
|
Default: `no limit`
|
|
maxPriority::
|
|
The maximum priority of messages in the queue (0-255).
|
|
+
|
|
Default: `none`
|
|
missingQueuesFatal::
|
|
When the queue cannot be found, whether to treat the condition as fatal and stop the listener container.
|
|
Defaults to `false` so that the container keeps trying to consume from the queue -- for example, when using a cluster and the node hosting a non-HA queue is down.
|
|
+
|
|
Default: `false`
|
|
overflowBehavior::
|
|
Action to take when `maxLength` or `maxLengthBytes` is exceeded; currently `drop-head` or `reject-publish` but refer to the RabbitMQ documentation.
|
|
+
|
|
Default: `none`
|
|
prefetch::
|
|
Prefetch count.
|
|
+
|
|
Default: `1`.
|
|
prefix::
|
|
A prefix to be added to the name of the `destination` and queues.
|
|
+
|
|
Default: "".
|
|
queueBindingArguments::
|
|
Arguments applied when binding the queue to the exchange; used with `headers` `exchangeType` to specify headers to match on.
|
|
For example `...queueBindingArguments.x-match=any`, `...queueBindingArguments.someHeader=someValue`.
|
|
+
|
|
Default: empty
|
|
queueDeclarationRetries::
|
|
The number of times to retry consuming from a queue if it is missing.
|
|
Relevant only when `missingQueuesFatal` is `true`.
|
|
Otherwise, the container keeps retrying indefinitely.
|
|
Not supported when the `containerType` is `direct`.
|
|
+
|
|
Default: `3`
|
|
queueNameGroupOnly::
|
|
When true, consume from a queue with a name equal to the `group`.
|
|
Otherwise the queue name is `destination.group`.
|
|
This is useful, for example, when using Spring Cloud Stream to consume from an existing RabbitMQ queue.
|
|
+
|
|
Default: false.
|
|
quorum.deliveryLimit::
|
|
When `quorum.enabled=true`, set a delivery limit after which the message is dropped or dead-lettered.
|
|
+
|
|
Default: none - broker default will apply.
|
|
quorum.enabled::
|
|
When true, create a quorum queue instead of a classic queue.
|
|
+
|
|
Default: false
|
|
quorum.initialGroupSize::
|
|
When `quorum.enabled=true`, set the initial quorum size.
|
|
+
|
|
Default: none - broker default will apply.
|
|
recoveryInterval::
|
|
The interval between connection recovery attempts, in milliseconds.
|
|
+
|
|
Default: `5000`.
|
|
requeueRejected::
|
|
Whether delivery failures should be re-queued when retry is disabled or `republishToDlq` is `false`.
|
|
+
|
|
Default: `false`.
|
|
[[spring-cloud-stream-rabbit-republish-delivery-mode]]
|
|
republishDeliveryMode::
|
|
When `republishToDlq` is `true`, specifies the delivery mode of the republished message.
|
|
+
|
|
Default: `DeliveryMode.PERSISTENT`
|
|
republishToDlq::
|
|
By default, messages that fail after retries are exhausted are rejected.
|
|
If a dead-letter queue (DLQ) is configured, RabbitMQ routes the failed message (unchanged) to the DLQ.
|
|
If set to `true`, the binder republishs failed messages to the DLQ with additional headers, including the exception message and stack trace from the cause of the final failure.
|
|
Also see the xref:rabbit/rabbit_overview/rabbitmq-consumer-properties.adoc#spring-cloud-stream-rabbit-frame-max-headroom[frameMaxHeadroom property].
|
|
+
|
|
Default: `true`
|
|
singleActiveConsumer::
|
|
Set to true to set the `x-single-active-consumer` queue property to true.
|
|
+
|
|
Default: `false`
|
|
transacted::
|
|
Whether to use transacted channels.
|
|
+
|
|
Default: `false`.
|
|
ttl::
|
|
Default time to live to apply to the queue when declared (in milliseconds).
|
|
+
|
|
Default: `no limit`
|
|
txSize::
|
|
The number of deliveries between acks.
|
|
Not supported when the `containerType` is `direct`.
|
|
+
|
|
Default: `1`.
|
|
|