|
For the latest stable version, please use spring-cloud-stream 4.3.0! |
RabbitMQ Producer Properties
The following properties are available for Rabbit producers only and must be prefixed with spring.cloud.stream.rabbit.bindings.<channelName>.producer..
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.
- altermateExchange.binding.queue
-
If the exchange does not already exist, and a
nameis provided, bind this queue to the alternate exhange. A simple durable queue with no arguments is provisioned; if more sophisticated configuration is required, you must configure and bind the queue yourself.Default:
nullalternateExchange.binding.routingKey If the exchange does not already exist, and anameandqueueis provided, bind the queue to the alternate exhange using this routing key.Default:
#(for the defaulttopicalternate exchange) - alternateExchange.exists
-
Whether the alternate exchange exists, or needs to be provisioned.
Default:
false - alternateExchange.type
-
If the alternate exchange does not already exist, the type of exchange to provision.
Default:
topic - alternateExchange.name
-
Configure an alternate exchange on the destination exchange.
Default:
null - autoBindDlq
-
Whether to automatically declare the DLQ and bind it to the binder DLX.
Default:
false. - batchingEnabled
-
Whether to enable message batching by producers. Messages are batched into one message according to the following properties (described in the next three entries in this list): 'batchSize',
batchBufferLimit, andbatchTimeout. See Batching for more information. Also see Receiving Batched Messages.Default:
false. - batchSize
-
The number of messages to buffer when batching is enabled.
Default:
100. - batchBufferLimit
-
The maximum buffer size when batching is enabled.
Default:
10000. - batchTimeout
-
The batch timeout when batching is enabled.
Default:
5000. - bindingRoutingKey
-
The routing key with which to bind the queue to the exchange (if
bindQueueistrue). Can be multiple keys - seebindingRoutingKeyDelimiter. For partitioned destinations,-nis appended to each key. Only applies ifrequiredGroupsare provided and then only to those groups.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. Only applies if
requiredGroupsare provided and then only to those groups.Default:
null. - bindQueue
-
Whether to declare the queue and bind it to the destination exchange. Set it to
falseif you have set up your own infrastructure and have previously created and bound the queue. Only applies ifrequiredGroupsare provided and then only to those groups.Default:
true. - compress
-
Whether data should be compressed when sent.
Default:
false. - confirmAckChannel
-
When
errorChannelEnabledis true, a channel to which to send positive delivery acknowledgments (aka publisher confirms). If the channel does not exist, aDirectChannelis registered with this name. The connection factory must be configured to enable publisher confirms. Mutually exclusive withuseConfirmHeader.Default:
nullChannel(acks are discarded). - deadLetterQueueName
-
The name of the DLQ Only applies if
requiredGroupsare provided and then only to those groups.Default:
prefix+destination.dlq - deadLetterExchange
-
A DLX to assign to the queue. Relevant only when
autoBindDlqistrue. Applies only whenrequiredGroupsare provided and then only to those groups.Default: 'prefix+DLX'
- deadLetterExchangeType
-
The type of the DLX to assign to the queue. Relevant only if
autoBindDlqistrue. Applies only whenrequiredGroupsare provided and then only to those groups.Default: 'direct'
- deadLetterRoutingKey
-
A dead letter routing key to assign to the queue. Relevant only when
autoBindDlqistrue. Applies only whenrequiredGroupsare provided and then only to those groups.Default:
destination - declareDlx
-
Whether to declare the dead letter exchange for the destination. Relevant only if
autoBindDlqistrue. Set tofalseif you have a pre-configured DLX. Applies only whenrequiredGroupsare provided and then only to those groups.Default:
true. - declareExchange
-
Whether to declare the exchange for the destination.
Default:
true. - delayExpression
-
A SpEL expression to evaluate the delay to apply to the message (
x-delayheader). It has no effect if the exchange is not a delayed message exchange.Default: No
x-delayheader is set. - delayedExchange
-
Whether to declare the exchange as a
Delayed Message Exchange. Requires the delayed message exchange plugin on the broker. Thex-delayed-typeargument is set to theexchangeType.Default:
false. - deliveryMode
-
The delivery mode.
Default:
PERSISTENT. - dlqBindingArguments
-
Arguments applied when binding the dlq to the dead letter exchange; used with
headersdeadLetterExchangeTypeto specify headers to match on. For example…dlqBindingArguments.x-match=any,…dlqBindingArguments.someHeader=someValue. Applies only whenrequiredGroupsare provided and then only to those groups.Default: empty
- dlqDeadLetterExchange
-
When a DLQ is declared, a DLX to assign to that queue. Applies only if
requiredGroupsare provided and then only to those groups.Default:
none - dlqDeadLetterRoutingKey
-
When a DLQ is declared, a dead letter routing key to assign to that queue. Applies only when
requiredGroupsare provided and then only to those groups.Default:
none - dlqExpires
-
How long (in milliseconds) before an unused dead letter queue is deleted. Applies only when
requiredGroupsare provided and then only to those groups.Default:
no expiration - dlqLazy
-
Declare the dead letter queue with the
x-queue-mode=lazyargument. See “Lazy Queues”. Consider using a policy instead of this setting, because using a policy allows changing the setting without deleting the queue. Applies only whenrequiredGroupsare provided and then only to those groups. - dlqMaxLength
-
Maximum number of messages in the dead letter queue. Applies only if
requiredGroupsare provided and then only to those groups.Default:
no limit - dlqMaxLengthBytes
-
Maximum number of total bytes in the dead letter queue from all messages. Applies only when
requiredGroupsare provided and then only to those groups.Default:
no limit - dlqMaxPriority
-
Maximum priority of messages in the dead letter queue (0-255) Applies only when
requiredGroupsare provided and then only to those groups.Default:
none - dlqQuorum.deliveryLimit
-
When
quorum.enabled=true, set a delivery limit after which the message is dropped or dead-lettered. Applies only whenrequiredGroupsare provided and then only to those groups.Default: none - broker default will apply.
- dlqQuorum.enabled
-
When true, create a quorum dead letter queue instead of a classic queue. Applies only when
requiredGroupsare provided and then only to those groups.Default: false
- dlqQuorum.initialGroupSize
-
When
quorum.enabled=true, set the initial quorum size. Applies only whenrequiredGroupsare provided and then only to those groups.Default: none - broker default will apply.
- dlqSingleActiveConsumer
-
Set to true to set the
x-single-active-consumerqueue property to true. Applies only whenrequiredGroupsare provided and then only to those groups.Default:
false - dlqTtl
-
Default time (in milliseconds) to live to apply to the dead letter queue when declared. Applies only when
requiredGroupsare provided and then only to those groups.Default:
no limit - exchangeAutoDelete
-
If
declareExchangeistrue, whether the exchange should be auto-delete (it is removed after the last queue is removed).Default:
true. - exchangeDurable
-
If
declareExchangeistrue, whether the exchange should be durable (survives broker restart).Default:
true. - exchangeType
-
The exchange type:
direct,fanout,headersortopicfor non-partitioned destinations anddirect,headersortopicfor partitioned destinations.Default:
topic. - expires
-
How long (in milliseconds) before an unused queue is deleted. Applies only when
requiredGroupsare provided and then only to those groups.Default:
no expiration - headerPatterns
-
Patterns for headers to be mapped to outbound messages.
Default:
['*'](all headers). - lazy
-
Declare the queue with the
x-queue-mode=lazyargument. See “Lazy Queues”. Consider using a policy instead of this setting, because using a policy allows changing the setting without deleting the queue. Applies only whenrequiredGroupsare provided and then only to those groups.Default:
false. - maxLength
-
Maximum number of messages in the queue. Applies only when
requiredGroupsare provided and then only to those groups.Default:
no limit - maxLengthBytes
-
Maximum number of total bytes in the queue from all messages. Only applies if
requiredGroupsare provided and then only to those groups.Default:
no limit - maxPriority
-
Maximum priority of messages in the queue (0-255). Only applies if
requiredGroupsare provided and then only to those groups.Default:
none - prefix
-
A prefix to be added to the name of the
destinationexchange.Default: "".
- producerType
-
The type of producer.
-
AMQPAMQP Client for classic and quorum queues -
STREAM_SYNCRabbitMQ Streams Plugin client, blocks until confirm is received -
STREAM_ASYNCRabbitMQ Streams Plugin client, does not blockDefault: "".
-
- queueBindingArguments
-
Arguments applied when binding the queue to the exchange; used with
headersexchangeTypeto specify headers to match on. For example…queueBindingArguments.x-match=any,…queueBindingArguments.someHeader=someValue. Applies only whenrequiredGroupsare provided and then only to those groups.Default: empty
- queueNameGroupOnly
-
When
true, consume from a queue with a name equal to thegroup. Otherwise the queue name isdestination.group. This is useful, for example, when using Spring Cloud Stream to consume from an existing RabbitMQ queue. Applies only whenrequiredGroupsare provided and then only to those groups.Default: false.
- quorum.deliveryLimit
-
When
quorum.enabled=true, set a delivery limit after which the message is dropped or dead-lettered. Applies only whenrequiredGroupsare provided and then only to those groups.Default: none - broker default will apply.
- quorum.enabled
-
When true, create a quorum queue instead of a classic queue. Applies only when
requiredGroupsare provided and then only to those groups.Default: false
- quorum.initialGroupSize
-
When
quorum.enabled=true, set the initial quorum size. Applies only whenrequiredGroupsare provided and then only to those groups.Default: none - broker default will apply.
- routingKeyExpression
-
A SpEL expression to determine the routing key to use when publishing messages. For a fixed routing key, use
routingKey.Default:
destinationordestination-<partition>for partitioned destinations. - routingKey
-
A string defining a fixed routing key to use when publishing messages.
Default: see
routingKeyExpression - singleActiveConsumer
-
Set to true to set the
x-single-active-consumerqueue property to true. Applies only whenrequiredGroupsare provided and then only to those groups.Default:
false - transacted
-
Whether to use transacted channels.
Default:
false. - ttl
-
Default time (in milliseconds) to live to apply to the queue when declared. Applies only when
requiredGroupsare provided and then only to those groups.Default:
no limit - useConfirmHeader
-
See Publisher Confirms. Mutually exclusive with
confirmAckChannel.In the case of RabbitMQ, content type headers can be set by external applications. Spring Cloud Stream supports them as part of an extended internal protocol used for any type of transport — including transports, such as Kafka (prior to 0.11), that do not natively support headers.