-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Affects Version(s): 2.7.3
When using BatchAcknowledgingMessageListener
to manually control commits, Acknowledgment#acknowledge()
(commit entire batch) will be synchronous/asynchronous depending on whether syncCommits
is set to true
/false
(assuming it is called from the consumer thread and ackMode
is AckMode.MANUAL_IMMEDIATE
).
But when using Acknowledgment#nack(int, long)
to partial commit a batch, the commit is always done asynchronously, regardless of whether syncCommits
is true
/false
. This has 2 downsides:
- Unless an arbitrarily long sleep time is set, the next
poll()
might be called before the commits complete, resulting in already successfully processed records being polled again - If the Kafka commit fails, it will not give the caller a chance to handle it (eg. rollback database transaction)
While neither of these issues are dealbreaking (consumers should be idempotent), it would be nice to have a way to partially commit synchronously.