-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Is Non Blocking Retry (@Retryable) intended to be combined with Kafka Transactions (consumer initiated) ? #2934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
KafkaListener nested producer transactions are not support Use
If not use @RetryTopic, will throw exception to transaction and rollback, Then |
Hi, @artembilan @sobychacko @PaulFert for this scenario(enable listener transaction and retry topic), retry topic break the listener kafka transaction atomicity, move retry topic logic to WDYT? |
* kafka Listener transaction nested kafka transactions does not support `@RetryableTopic`. * add adoc to notice see spring-projects#2934
* Enable non-blocking retries and container transaction, when listener code threw error, catch by `DefaultErrorHandler` and recover success. Container transactions commit success and send record to a retryable topic. * Desired behavior is Container transactions rollback, send offsets commit transaction success, send record to a retryable topic. * Add adoc to notice. see spring-projects#2934
Discussed in #2918
Originally posted by PaulFert December 1, 2023
Hello,
I wanted to use both features for consume -> process -> produce applications
When i use Transaction with Blocking Retry, DLT Recover the flow is :

When exception is raised from the listener, the transaction is rollback and then a new transaction is created for the send to DLT, OK fine.
On the oher side, when i use Transaction with Non Blocking Retry the flow is more like that :

When exception is raised from the listener, the transaction is not rollback, the message is send to retry topic and finally the transaction is comited. Then consumer offsets is commit plus the messages out and messages to retry topic. If an exception is raised i want my messages out to be not comited.
It's not what i expected, i expected a flow like that :

Did i miss something with the configuration ? I use standard configuration, with one kafkatemplate, with transactional producer
Or maybe did i misunderstood the Non Blocking Retry pattern, Transactions are not intended to be combined with ?
Sorry for my poor english...
Testing with 'org.springframework.boot' version '3.1.1-SNAPSHOT', spring-kafka version 3.0.8
Thanks
The text was updated successfully, but these errors were encountered: