RabbitMQ Producer Properties
在使用 Spring Cloud Stream 与 RabbitMQ 集成时,可以单独为每个通道设置属性,也可以将属性设置为所有通道的默认值,避免重复配置。特定绑定属性的值将覆盖其在默认值中的同等值。
以下属性仅适用于 Rabbit 生产者,且必须使用 spring.cloud.stream.rabbit.bindings.<channelName>.producer.
前缀。
The following properties are available for Rabbit producers only and must be prefixed with spring.cloud.stream.rabbit.bindings.<channelName>.producer.
.
然而,如果需要将同一组属性应用于大多数绑定,可通过 Spring Cloud Stream 设置所有通道的值(格式为 spring.cloud.stream.rabbit.default.<property>=<value>
),避免重复。
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
name
is 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.默认:
nullalternateExchange.binding.routingKey
,如果交换机还不存在,且提供了name
和queue
,则使用此路由键将队列绑定到备用交换机。
Default: null
alternateExchange.binding.routingKey
If the exchange does not already exist, and a name
and queue
is provided, bind the queue to the alternate exhange using this routing key.
默认:#
(为默认 topic
备用交换机)
Default: #
(for the default topic
alternate exchange)
- alternateExchange.exists
-
Whether the alternate exchange exists, or needs to be provisioned.
默认值:
false
Default: false
- alternateExchange.type
-
If the alternate exchange does not already exist, the type of exchange to provision.
默认:
topic
Default: topic
- alternateExchange.name
-
Configure an alternate exchange on the destination exchange.
默认值:
null
Default: null
- autoBindDlq
-
Whether to automatically declare the DLQ and bind it to the binder DLX.
默认:
false
.
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.默认:
false
.
Default: false
.
- batchSize
-
The number of messages to buffer when batching is enabled.
默认:
100
。
Default: 100
.
- batchBufferLimit
-
The maximum buffer size when batching is enabled.
默认值:
10000
。
Default: 10000
.
- batchTimeout
-
The batch timeout when batching is enabled.
默认:
5000
。
Default: 5000
.
- bindingRoutingKey
-
The routing key with which to bind the queue to the exchange (if
bindQueue
istrue
). Can be multiple keys - seebindingRoutingKeyDelimiter
. For partitioned destinations,-n
is appended to each key. Only applies ifrequiredGroups
are 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
requiredGroups
are provided and then only to those groups.默认值:
null
。
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. Only applies ifrequiredGroups
are provided and then only to those groups.默认:“true”。
Default: true
.
- compress
-
Whether data should be compressed when sent.
默认:
false
.
Default: false
.
- confirmAckChannel
-
When
errorChannelEnabled
is true, a channel to which to send positive delivery acknowledgments (aka publisher confirms). If the channel does not exist, aDirectChannel
is registered with this name. The connection factory must be configured to enable publisher confirms. Mutually exclusive withuseConfirmHeader
.默认:
nullChannel
(丢弃 ack)。
Default: nullChannel
(acks are discarded).
- deadLetterQueueName
-
The name of the DLQ Only applies if
requiredGroups
are provided and then only to those groups.默认:
prefix+destination.dlq
Default: prefix+destination.dlq
- deadLetterExchange
-
A DLX to assign to the queue. Relevant only when
autoBindDlq
istrue
. Applies only whenrequiredGroups
are provided and then only to those groups.默认:
prefix+DLX
Default: 'prefix+DLX'
- deadLetterExchangeType
-
The type of the DLX to assign to the queue. Relevant only if
autoBindDlq
istrue
. Applies only whenrequiredGroups
are provided and then only to those groups.默认:
direct
Default: 'direct'
- deadLetterRoutingKey
-
A dead letter routing key to assign to the queue. Relevant only when
autoBindDlq
istrue
. Applies only whenrequiredGroups
are provided and then only to those groups.默认:
destination
Default: destination
- declareDlx
-
Whether to declare the dead letter exchange for the destination. Relevant only if
autoBindDlq
istrue
. Set tofalse
if you have a pre-configured DLX. Applies only whenrequiredGroups
are provided and then only to those groups.默认:“true”。
Default: true
.
- declareExchange
-
Whether to declare the exchange for the destination.
默认:“true”。
Default: true
.
- delayExpression
-
A SpEL expression to evaluate the delay to apply to the message (
x-delay
header). It has no effect if the exchange is not a delayed message exchange.默认:未设置
x-delay
标头。
Default: No x-delay
header is set.
- delayedExchange
-
Whether to declare the exchange as a
Delayed Message Exchange
. Requires the delayed message exchange plugin on the broker. Thex-delayed-type
argument is set to theexchangeType
.默认:
false
.
Default: false
.
- deliveryMode
-
The delivery mode.
默认值:
PERSISTENT
。
Default: PERSISTENT
.
- 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
. Applies only whenrequiredGroups
are 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
requiredGroups
are provided and then only to those groups.默认值:
none
Default: none
- dlqDeadLetterRoutingKey
-
When a DLQ is declared, a dead letter routing key to assign to that queue. Applies only when
requiredGroups
are provided and then only to those groups.默认值:
none
Default: none
- dlqExpires
-
How long (in milliseconds) before an unused dead letter queue is deleted. Applies only when
requiredGroups
are provided and then only to those groups.默认值:
no expiration
Default: no expiration
- dlqLazy
-
Declare the dead letter queue with the
x-queue-mode=lazy
argument. 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 whenrequiredGroups
are provided and then only to those groups. - dlqMaxLength
-
Maximum number of messages in the dead letter queue. Applies only if
requiredGroups
are provided and then only to those groups.默认值:
no limit
Default: no limit
- dlqMaxLengthBytes
-
Maximum number of total bytes in the dead letter queue from all messages. Applies only when
requiredGroups
are provided and then only to those groups.默认值:
no limit
Default: no limit
- dlqMaxPriority
-
Maximum priority of messages in the dead letter queue (0-255) Applies only when
requiredGroups
are provided and then only to those groups.默认值:
none
Default: none
- dlqQuorum.deliveryLimit
-
When
quorum.enabled=true
, set a delivery limit after which the message is dropped or dead-lettered. Applies only whenrequiredGroups
are 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
requiredGroups
are provided and then only to those groups.默认值:false
Default: false
- dlqQuorum.initialGroupSize
-
When
quorum.enabled=true
, set the initial quorum size. Applies only whenrequiredGroups
are provided and then only to those groups.默认值:无,将应用代理默认值。
Default: none - broker default will apply.
- dlqSingleActiveConsumer
-
Set to true to set the
x-single-active-consumer
queue property to true. Applies only whenrequiredGroups
are provided and then only to those groups.默认值:
false
Default: false
- dlqTtl
-
Default time (in milliseconds) to live to apply to the dead letter queue when declared. Applies only when
requiredGroups
are provided and then only to those groups.默认值:
no limit
Default: no limit
- exchangeAutoDelete
-
If
declareExchange
istrue
, whether the exchange should be auto-delete (it is removed after the last queue is removed).默认:“true”。
Default: true
.
- exchangeDurable
-
If
declareExchange
istrue
, whether the exchange should be durable (survives broker restart).默认:“true”。
Default: true
.
- exchangeType
-
The exchange type:
direct
,fanout
,headers
ortopic
for non-partitioned destinations anddirect
,headers
ortopic
for partitioned destinations.默认值:
topic
。
Default: topic
.
- expires
-
How long (in milliseconds) before an unused queue is deleted. Applies only when
requiredGroups
are provided and then only to those groups.默认值:
no expiration
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=lazy
argument. 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 whenrequiredGroups
are provided and then only to those groups.默认:
false
.
Default: false
.
- maxLength
-
Maximum number of messages in the queue. Applies only when
requiredGroups
are provided and then only to those groups.默认值:
no limit
Default: no limit
- maxLengthBytes
-
Maximum number of total bytes in the queue from all messages. Only applies if
requiredGroups
are provided and then only to those groups.默认值:
no limit
Default: no limit
- maxPriority
-
Maximum priority of messages in the queue (0-255). Only applies if
requiredGroups
are provided and then only to those groups.默认值:
none
Default: none
- prefix
-
A prefix to be added to the name of the
destination
exchange.默认值:""。
Default: "".
- producerType
-
The type of producer.
-
AMQP
AMQP Client for classic and quorum queues -
STREAM_SYNC
RabbitMQ Streams Plugin client, blocks until confirm is received -
STREAM_ASYNC
RabbitMQ Streams Plugin client, does not block[.iokays-translated-cac1aae87e5f578b7c2481722c04cb0b] 默认值:""。
-
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
. Applies only whenrequiredGroups
are 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 whenrequiredGroups
are provided and then only to those groups.默认值:false。
Default: false.
- quorum.deliveryLimit
-
When
quorum.enabled=true
, set a delivery limit after which the message is dropped or dead-lettered. Applies only whenrequiredGroups
are 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
requiredGroups
are provided and then only to those groups.默认值:false
Default: false
- quorum.initialGroupSize
-
When
quorum.enabled=true
, set the initial quorum size. Applies only whenrequiredGroups
are 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
.默认值:对于已分区的目标,为
destination
或destination-<partition>
。
Default: destination
or destination-<partition>
for partitioned destinations.
- routingKey
-
A string defining a fixed routing key to use when publishing messages.
默认值:请参阅
routingKeyExpression
。
Default: see routingKeyExpression
- singleActiveConsumer
-
Set to true to set the
x-single-active-consumer
queue property to true. Applies only whenrequiredGroups
are provided and then only to those groups.默认值:
false
Default: false
- transacted
-
Whether to use transacted channels.
默认:
false
.
Default: false
.
- ttl
-
Default time (in milliseconds) to live to apply to the queue when declared. Applies only when
requiredGroups
are provided and then only to those groups.默认值:
no limit
Default: no limit
- useConfirmHeader
-
See Publisher Confirms. Mutually exclusive with
confirmAckChannel
.就 RabbitMQ 而言,外部应用程序可以设置内容类型标头。Spring Cloud Stream 将它们作为用于任何类型的传输的扩展内部协议的一部分提供支持——包括 本身不支持标头的传输(例如早期的 Kafka(介于 0.11 之前))。
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. |