-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Align default behavior of @RetryableTopic
and RetryTopicConfigurationBuilder
with documentation
#3706
Comments
If we take a closer look into that PR, we will see that even The change which made an inconsistency is this one: #3052. And even if what you suggest makes sense, it is still a breaking change. Feel free to raise a PR and it will be reviewed and merged in respective timeline. Thank you! |
@artembilan I need to think about this a bit more. While reusing a single topic has its advantages, it also comes with disadvantages. Let me share my thoughts on the pros and cons of using a single topic for retries. Pros1. Easier for beginners to understand and get started
2. Requires fewer resources for topic creation and management
Cons1. Potential delays in processing subsequent messages
2. Difficulty in tracking retry attempts
3. Other potential disadvantages
I am uncertain which approach would be better when considering these factors. I would greatly appreciate your thoughts on this matter. |
@bky373 we are thinking about starting the |
@sobychacko However, I agree it’s better to take time with this change since it could have some impact (even though parts of it are already applied). If I come up with a good idea before work on 4.0.x starts, I’ll be sure to share it with you. Thank you for your reply! |
In what version(s) of Spring for Apache Kafka are you seeing this issue?
Since 3.2.0
Describe the bug
The default behavior of @RetryableTopic (SINGLE_TOPIC) differs from both RetryTopicConfigurationBuilder (MULTIPLE_TOPICS) and the Spring Kafka documentation, which describes using separate topics. Unifying all to SINGLE_TOPIC makes sense but needs documentation updates and clarification of changes.
1. Inconsistency with Documentation
The Spring Kafka documentation describes the default behavior for non-blocking retries as creating separate retry topics.
However, when using @RetryableTopic, the default behavior is to reuse the same topic for identical intervals. This means that without specifying any attributes (defaulting to FixedBackOff with attempts=3 and delay=1000ms), the retry topic will be reused. This change was introduced with PR 3058, which updated the default SameIntervalTopicReuseStrategy from MULTIPLE_TOPICS to SINGLE_TOPIC.
It would be ideal for the documentation and default behavior to be consistent.
2. Inconsistency with the Builder
As you know, non-blocking retries can also be configured using RetryTopicConfigurationBuilder instead of @RetryableTopic.
The default behavior of RetryTopicConfigurationBuilder.sameIntervalTopicReuseStrategy should align with the default behavior of @RetryableTopic to avoid confusion for users.
Currently, the builder’s default is still set to MULTIPLE_TOPICS, which is inconsistent with @RetryableTopic. The behavior of these two components should be unified.
3. Direction for Defaults
Referring to PR 2497, using SINGLE_TOPIC is more practical for exponential backoff scenarios. However, selecting SINGLE_TOPIC will also affect Fixed Backoff, as mentioned earlier.
If SINGLE_TOPIC is chosen as the default, the documentation regarding the default behavior should be revised.
Additionally, it’s crucial to highlight that this behavior differs significantly from previous versions.
While I’ve already updated the RetryTopicConfigurationBuilder.sameIntervalTopicReuseStrategy value to SINGLE_TOPIC and documented the changes, I want to ensure that this aligns with the intended direction. I’d appreciate your feedback on this matter.
To Reproduce
The text was updated successfully, but these errors were encountered: