批處理訊息

由生產者建立的批處理訊息會被監聽器容器自動解批 (使用 springBatchFormat 訊息頭)。拒絕批處理中的任何訊息會導致整個批處理被拒絕。請參閱 批處理 獲取有關批處理的更多資訊。

從 2.2 版本開始,SimpleMessageListenerContainer 可用於在消費者端建立批處理(當生產者傳送的是離散訊息時)。

將容器屬性 consumerBatchEnabled 設定為 true 以啟用此功能。deBatchingEnabled 也必須為 true,以便容器負責處理這兩種型別的批處理。當 consumerBatchEnabled 為 true 時,實現 BatchMessageListenerChannelAwareBatchMessageListener。從 2.2.7 版本開始,SimpleMessageListenerContainerDirectMessageListenerContainer 都可以將生產者建立的批處理作為 List<Message> 解批。請參閱 帶批處理的 @RabbitListener 獲取有關在 @RabbitListener 中使用此功能的更多資訊。