该版本仍在开发中,尚未被视为稳定。请使用最新的稳定版本,使用 Spring AMQP 4.0.0!spring-doc.cadn.net.cn

批量消息

批量消息(由生产者创建)会被监听器容器自动去批处理(使用springBatch格式消息头部)。 拒绝批处理中的任何消息会导致整个批次被拒绝。 有关批处理的更多信息,请参见“批处理”。spring-doc.cadn.net.cn

从2.2版本开始,SimpleMessageListenerContainer可用于在消费者端创建批量(生产者发送离散消息)。spring-doc.cadn.net.cn

设置容器属性consumerBatchEnabled以启用此功能。deBatchingEnabled还必须为真,使容器负责处理这两种类型的批次。 实现批处理消息监听器ChannelAwareBatchMessageListener什么时候consumerBatchEnabled是真的。 从2.2.7版本开始,两者SimpleMessageListenerContainerDirectMessageListenerContainer能否分批生产者创建的批次列表<消息>. 有关使用该功能的信息,请参见批处理@RabbitListener@RabbitListener.spring-doc.cadn.net.cn