Does an asynchronous return type in a @KafkaListener requires using manual ACKs? #3290
-
The documentation is a little bit unclear
For example, when the listener is suspend-ing, do I need to manually acknowledge? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The framework automatically sets the ack mode to Here is the PR that made this change: https://github.com/spring-projects/spring-kafka/pull/2996/files This section especially might be relevant: https://github.com/spring-projects/spring-kafka/pull/2996/files#diff-377d3bd2ec14091e61c082bdd64fd3881fe134f5c9bf043ac3e4f78bca2a051fR474 |
Beta Was this translation helpful? Give feedback.
-
Out-of-order commits are enabled automatically when async replies are used. This means that offsets could be committed out-of-order when processing records in a listener using async replies, which implies that the records may be processed in parallel. As to the specific exception you are observing, I don't know what's going on. This is a new feature, and it could be possible that there might be some gaps. If you have a reproducible sample, we can look at it and see what's going on. |
Beta Was this translation helpful? Give feedback.
The framework automatically sets the ack mode to
MANUAL
when enabling async replies. This means that the normal ack mechanisms in a regular listener are not applied here; rather, the framework manually acknowledges the record once the async processing is complete. It might look a bit confusing sinceMANUAL
means the users are acknowledging it manually in the application and not the framework, but in the case of async replies,MANUAL
means that the framework waits for the completion callback to return and then manually ack it. Therefore, you do not need to do any manual acknowledgment when the listener is suspended.Here is the PR that made this change: https://github.com/spring-projects/s…