Batched Messages

批处理消息(由生产者创建)由侦听器容器(使用 springBatchFormat 消息头)自动解除批处理。拒绝批处理中的任何消息都会导致拒绝整个批处理。有关批处理的更多信息,请参见 Batching

Batched messages (created by a producer) are automatically de-batched by listener containers (using the springBatchFormat message header). Rejecting any message from a batch causes the entire batch to be rejected. See Batching for more information about batching.

从版本 2.2 开始,SimpleMessageListenerContainer 可用于在消费者侧创建批次(生产者发送离散消息)。

Starting with version 2.2, the SimpleMessageListenerContainer can be use to create batches on the consumer side (where the producer sent discrete messages).

设置容器属性 consumerBatchEnabled 以启用此功能。deBatchingEnabled 也必须为 true,以便容器负责处理这两种类型的批处理。在 consumerBatchEnabled 为 true 时实现 BatchMessageListenerChannelAwareBatchMessageListener。从版本 2.2.7 开始,SimpleMessageListenerContainerDirectMessageListenerContainer 都可以将 producer created batches 解除批处理,就像 List<Message> 一样。有关将此功能与 @RabbitListener 一起使用的信息,请参见 @RabbitListener with Batching

Set the container property consumerBatchEnabled to enable this feature. deBatchingEnabled must also be true so that the container is responsible for processing batches of both types. Implement BatchMessageListener or ChannelAwareBatchMessageListener when consumerBatchEnabled is true. Starting with version 2.2.7 both the SimpleMessageListenerContainer and DirectMessageListenerContainer can debatch producer created batches as List<Message>. See @RabbitListener with Batching for information about using this feature with @RabbitListener.