Batch Listener(AckMode.MANUAL_IMMEDIATE) acks message even if acknowledgment.acknowledge() is not invoked #3982
Replies: 2 comments
-
Hi @artembilan @sobychacko, Could anyone please help with above query? Thanks |
Beta Was this translation helpful? Give feedback.
-
You're seeing expected behavior here. When using The reasoning behind this is defensive programming. We assume that if your listener returns normally, processing was successful and the messages should be acknowledged. This prevents scenarios where developers forget to call If you need full manual control, without automatic acknowledgment, you should use
To keep your current approach with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I have a query regarding working of MANUAL_IMMEDIATE mode with BatchAcknowledgingMessageListener.
In the onMessage function if I do not invoke acknowledgment.acknowledge() the messages are still getting acked, is this expected?
Spring Kafka: 3.3.0
enable.auto.commit = false
AckMode: AckMode.MANUAL_IMMEDIATE
Below is my onMessage function of
public class KafkaMessageBatchManualModeListener implements BatchAcknowledgingMessageListener<String, Object>
`@Override
public void onMessage(List<ConsumerRecord<String, Object>> data, Acknowledgment acknowledgment) {
My expectation is if I do not invoke acknowledgment.acknowledge(index) function (ref: else block or catch block case)
then my messages should get redelivered in next poll, but they get acked.
To stop that ack I have to explicitly use nack
`if(ackIndex != null){
`
Beta Was this translation helpful? Give feedback.
All reactions