批次訊息
批次訊息 (由生產者建立) 會由監聽器容器自動解批次 (使用 springBatchFormat
訊息標頭)。 拒絕批次中的任何訊息會導致整個批次被拒絕。 請參閱 批次處理 以取得關於批次處理的更多資訊。
從 2.2 版開始,SimpleMessageListenerContainer
可以用於在消費者端建立批次 (生產者在消費者端傳送離散訊息)。
設定容器屬性 consumerBatchEnabled
以啟用此功能。 deBatchingEnabled
也必須為 true,以便容器負責處理兩種批次類型。 當 consumerBatchEnabled
為 true 時,實作 BatchMessageListener
或 ChannelAwareBatchMessageListener
。 從 2.2.7 版開始,SimpleMessageListenerContainer
和 DirectMessageListenerContainer
都可以將 生產者建立的批次 解批次為 List<Message>
。 請參閱 搭配批次的 @RabbitListener 以取得關於搭配 @RabbitListener
使用此功能的資訊。