-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Non-Blocking Retries cannot combine with container transactions. #3072
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
Merged
sobychacko
merged 2 commits into
spring-projects:main
from
Wzy19930507:listener_tx_nested_kafka_tx_not_support_retry_topic
Feb 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what expected from asynchronous, non-blocking retries?
To be able to send to the retry topic we indeed has to commit the current transaction.
I'm not fully sure how this non-blocking retires work internally, but apparently we don't start a new transaction, when we consume from the next retry topic.
It might work some way with a
@Transactional
on the@KafkaListener
, but pay attention that@EnableTransactionManagement
has to be activated.Either way: I would not say in the docs
break
.It sounds like a bug which is not supposed to be there.
It is just a feature which cannot be combined with transactions due to async nature.
Do you see things differently?
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree with you, i'll re-test the
@Transactional
case.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test result is non-blocking retries cannot be combined with transactions.
@Transactional
case as follows:When
PROPAGATION_REQUIRED
will infinite retry because of container transactions rollback. (un-expected).When
PROPAGATION_REQUIRED_NEW
Current
KafkaTransactionManager
only supportPROPAGATION_REQUIRES_NEW
andPROPAGATION_REQUIRED
, the above case tests only these two cases.PROPAGATION_REQUIRED_NEW un-expected Report see https://github.com/Wzy19930507/spring-kafka/tree/report_pr_3072
Please see if there are any omissions, thanks.
I'll modify docs to Non-blocking retries cannot be combined with container transactions first and see if there's a way to implement it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Wzy19930507 We might want to use present tense here:
When the listener code throws an exception, container transaction commit succeeds, and the record is sent to the retryable topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the correction, fix it.