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