RabbitMQ Consumer Properties

以下属性仅适用于 Rabbit 消费者,并且必须以 spring.cloud.stream.rabbit.bindings.<channelName>.consumer. 作为前缀。

然而,如果需要将同一组属性应用于大多数绑定,可通过 Spring Cloud Stream 设置所有通道的值(格式为 spring.cloud.stream.rabbit.default.<property>=<value>),避免重复。

另外,请记住,特定绑定属性的值将覆盖其在默认值中的等值。

acknowledgeMode

The acknowledge mode.

默认值: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.

默认值:anonymous..

autoBindDlq

Whether to automatically declare the DLQ and bind it to the binder DLX.

默认: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.

默认:#

bindingRoutingKeyDelimiter

When this is not null, 'bindingRoutingKey' is considered to be a list of keys delimited by this value; often a comma is used.

默认值: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.

默认:“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}.

默认值:无,该代理将生成随机消费者标记。

containerType

Select the type of listener container to be used. See Choosing a Container in the Spring AMQP documentation for more information. Also see [rabbitmq-stream].

默认值:simple

deadLetterQueueName

The name of the DLQ

默认:prefix+destination.dlq

deadLetterExchange

A DLX to assign to the queue. Relevant only if autoBindDlq is true.

默认:prefix+DLX

deadLetterExchangeType

The type of the DLX to assign to the queue. Relevant only if autoBindDlq is true.

默认:direct

deadLetterRoutingKey

A dead letter routing key to assign to the queue. Relevant only if autoBindDlq is true.

默认: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.

默认:“true”。

declareExchange

Whether to declare the exchange for the destination.

默认:“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.

默认: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.

默认值:空

dlqDeadLetterExchange

If a DLQ is declared, a DLX to assign to that queue.

默认值:none

dlqDeadLetterRoutingKey

If a DLQ is declared, a dead letter routing key to assign to that queue.

默认值:none

dlqExpires

How long before an unused dead letter queue is deleted (in milliseconds).

默认值: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.

默认:false.

dlqMaxLength

Maximum number of messages in the dead letter queue.

默认值:no limit

dlqMaxLengthBytes

Maximum number of total bytes in the dead letter queue from all messages.

默认值:no limit

dlqMaxPriority

Maximum priority of messages in the dead letter queue (0-255).

默认值:none

dlqOverflowBehavior

Action to take when dlqMaxLength or dlqMaxLengthBytes is exceeded; currently drop-head or reject-publish but refer to the RabbitMQ documentation.

默认值:none

dlqQuorum.deliveryLimit

When quorum.enabled=true, set a delivery limit after which the message is dropped or dead-lettered.

默认值:无,将应用代理默认值。

dlqQuorum.enabled

When true, create a quorum dead letter queue instead of a classic queue.

默认值:false

dlqQuorum.initialGroupSize

When quorum.enabled=true, set the initial quorum size.

默认值:无,将应用代理默认值。

dlqSingleActiveConsumer

Set to true to set the x-single-active-consumer queue property to true.

默认值:false

dlqTtl

Default time to live to apply to the dead letter queue when declared (in milliseconds).

默认值:no limit

durableSubscription

Whether the subscription should be durable. Only effective if group is also set.

默认:“true”。

exchangeAutoDelete

If declareExchange is true, whether the exchange should be auto-deleted (that is, removed after the last queue is removed).

默认:“true”。

exchangeDurable

If declareExchange is true, whether the exchange should be durable (that is, it survives broker restart).

默认:“true”。

exchangeType

The exchange type: direct, fanout, headers or topic for non-partitioned destinations and direct, headers or topic for partitioned destinations.

默认值: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.

默认:false.

expires

How long before an unused queue is deleted (in milliseconds).

默认值:no expiration

failedDeclarationRetryInterval

The interval (in milliseconds) between attempts to consume from a queue if it is missing.

默认值:5000

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.

默认:20000

headerPatterns

Patterns for headers to be mapped from inbound messages.

默认值: ['*'](所有头)。

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.

默认:false.

maxConcurrency

The maximum number of consumers. Not supported when the containerType is direct.

默认:1.

maxLength

The maximum number of messages in the queue.

默认值:no limit

maxLengthBytes

The maximum number of total bytes in the queue from all messages.

默认值:no limit

maxPriority

The maximum priority of messages in the queue (0-255).

默认值: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.

默认值:false

overflowBehavior

Action to take when maxLength or maxLengthBytes is exceeded; currently drop-head or reject-publish but refer to the RabbitMQ documentation.

默认值:none

prefetch

Prefetch count.

默认:1.

prefix

A prefix to be added to the name of the destination and queues.

默认值:""。

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.

默认值:空

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.

默认: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.

默认值:false。

quorum.deliveryLimit

When quorum.enabled=true, set a delivery limit after which the message is dropped or dead-lettered.

默认值:无,将应用代理默认值。

quorum.enabled

When true, create a quorum queue instead of a classic queue.

默认值:false

quorum.initialGroupSize

When quorum.enabled=true, set the initial quorum size.

默认值:无,将应用代理默认值。

recoveryInterval

The interval between connection recovery attempts, in milliseconds.

默认:5000

requeueRejected

Whether delivery failures should be re-queued when retry is disabled or republishToDlq is false.

默认:false.

republishDeliveryMode

When republishToDlq is true, specifies the delivery mode of the republished message.

默认: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 frameMaxHeadroom property.

默认:true

singleActiveConsumer

Set to true to set the x-single-active-consumer queue property to true.

默认值:false

transacted

Whether to use transacted channels.

默认:false.

ttl

Default time to live to apply to the queue when declared (in milliseconds).

默认值:no limit

txSize

The number of deliveries between acks. Not supported when the containerType is direct.

默认:1.