-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-2806: Receiving an empty list with RecordFilterStrategy
Fixes: #2806 Motivation: Receiving an empty list when using `RecordFilterStrategy` on batch messages In the current batch mode, even if the `RecordFilterStrategy` filters all records resulting in an Empty List being returned, the KafkaListener is still invoked. In contrast, in single record mode, if record are filtered, the `KafkaListener` is not called. This difference in behavior between the two modes can cause confusion for users. Modifications: Add public method `isAnyManualAck()` to `Acknowledgment` to verify that `manualAck` is needed on `FilteringBatchMessageListenerAdapter`. Modify `FilteringBatchMessageListenerAdapter`. add field `consumerAware` as final (IMHO, we don't need to calculate it every single call `onMessage()`). add logic (if empty list and manual Ack == true, KafkaListener will be invoked. If empty list and manual Ack == false, `KafkaListener` will not be invoked even if listener is kind of ConsumerAware. In detail, See Discussion section below. Result: Receiving an empty list when using RecordFilterStrategy on batch messages #2806 When the RecordFilterStrategy filters all records and returns an Empty List, the KafkaListener is invoked only if it is in manual ACK mode. Discussion: When using a ConsumerAware Listener, commits can be made using `Consumer.commitSync()` and `Consumer.commitAsync()`. However, when using a `ConsumerAwareAckListener`, it seems possible that commits using the Consumer and commits using Ack could be processed simultaneously. That situation seems quite ambiguous.
- Loading branch information
1 parent
3c2bd93
commit f91f8a9
Showing
5 changed files
with
269 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.