Skip to content

GH-3706: Align RetryTopicConfigurationBuilder default with @RetryableTopic#4235

Open
h2jinee wants to merge 1 commit intospring-projects:mainfrom
h2jinee:GH-3706
Open

GH-3706: Align RetryTopicConfigurationBuilder default with @RetryableTopic#4235
h2jinee wants to merge 1 commit intospring-projects:mainfrom
h2jinee:GH-3706

Conversation

@h2jinee
Copy link

@h2jinee h2jinee commented Jan 9, 2026

Fixes #3706

Summary

Align the default sameIntervalTopicReuseStrategy in RetryTopicConfigurationBuilder with @RetryableTopic annotation (both now default to SINGLE_TOPIC).

Changes

  • Change default from MULTIPLE_TOPICS to SINGLE_TOPIC in RetryTopicConfigurationBuilder
  • Update topic-naming.adoc to reflect new default behavior
  • Add migration guide in whats-new.adoc
  • Update tests to explicitly use MULTIPLE_TOPICS where needed

Migration

To restore previous behavior:

RetryTopicConfigurationBuilder
    .newInstance()
    .sameIntervalTopicReuseStrategy(SameIntervalTopicReuseStrategy.MULTIPLE_TOPICS)
    .create(template);

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, rebase your PR to latest main.
Fix the respective new for the change to 4.1 already.
Add your name to the @author list of all the affected classes.

@h2jinee
Copy link
Author

h2jinee commented Mar 11, 2026

Rebased on latest main, updated the whats-new.adoc section ID to 4.1, and added @author to the affected classes. Thanks for the review!

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.
Please, find our further review below.


NOTE: The default behavior is to create separate retry topics for each attempt, appended with an index value: retry-0, retry-1, ..., retry-n.
Therefore, by default the number of retry topics is the configured `maxAttempts` minus 1.
NOTE: Starting with version 4.0, the default behavior is to reuse a single retry topic for the same delay intervals. To create separate retry topics for each attempt, set `sameIntervalTopicReuseStrategy` to `MULTIPLE_TOPICS`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this one.
We are already in version 4.1.

.sameIntervalTopicReuseStrategy(SameIntervalTopicReuseStrategy.MULTIPLE_TOPICS)
.create(template);
}
----
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what whats-new is about.
We should give a short description of what was changes and lead to the target chapter with more details.

@h2jinee
Copy link
Author

h2jinee commented Mar 12, 2026

Thanks! I've updated the version and the whats-new description. Let me know if this looks good to you.

@artembilan
Copy link
Member

Please, rebase your branch to the latest upstream main and fix those conflicts in the whats-new.adoc
Thanks

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just couple nit-picks for code perfection.

Thanks


NOTE: The default behavior is to create separate retry topics for each attempt, appended with an index value: retry-0, retry-1, ..., retry-n.
Therefore, by default the number of retry topics is the configured `maxAttempts` minus 1.
NOTE: Starting with version 4.1, the default behavior is to reuse a single retry topic for the same delay intervals. To create separate retry topics for each attempt, set `sameIntervalTopicReuseStrategy` to `MULTIPLE_TOPICS`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

----

NOTE: The default behavior is creating separate retry topics for each attempt, appended with their index values: retry-0, retry-1, ...
NOTE: Starting with version 4.1, the default behavior is to use a single topic for fixed delay retries. To use multiple topics, set `sameIntervalTopicReuseStrategy` to `MULTIPLE_TOPICS`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

See xref:kafka/receiving-messages/listener-annotation.adoc[`@KafkaListener` Annotation] for more information.

[[x41-retry-topic-builder-default]]
=== RetryTopicConfigurationBuilder Default Strategy Change
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RetryTopicConfigurationBuilder has to be present as a code snippet. Use single back-ticks to do that.

@h2jinee
Copy link
Author

h2jinee commented Mar 13, 2026

I've applied the requested changes. Please let me know if anything else is needed.
Thanks

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, rebase your branch to the latest upstream main:

git checkout main
git pull upstream main
git checkout -
git rebase main

There might be some conflicts for that whats-new, but that is exactly why I'm asking you to do that.

Thanks

…with @RetryableTopic

Fixes spring-projectsGH-3706 (spring-projects#3706)

* change default sameIntervalTopicReuseStrategy from MULTIPLE_TOPICS to SINGLE_TOPIC
* update topic-naming.adoc to reflect new default behavior
* add migration guide in whats-new.adoc
* update tests to explicitly use MULTIPLE_TOPICS where needed

Signed-off-by: h2jinee <wjsgmlwls97@gmail.com>
@h2jinee
Copy link
Author

h2jinee commented Mar 14, 2026

Rebased onto the latest upstream main and resolved the whats-new conflict.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align default behavior of @RetryableTopic and RetryTopicConfigurationBuilder with documentation

3 participants