Skip to content

Move common APIs from rabbit module to core#3289

Merged
cppwfs merged 1 commit intospring-projects:mainfrom
artembilan:common_apis
Jan 16, 2026
Merged

Move common APIs from rabbit module to core#3289
cppwfs merged 1 commit intospring-projects:mainfrom
artembilan:common_apis

Conversation

@artembilan
Copy link
Copy Markdown
Member

Some exceptions and listener supporting classes
are not only for RabbitMQ integration.
They can be used in any other Spring AMQP implementations.

  • Deprecate existing classes in favor of their new counterpart with extensions where possible.
  • Still use instances of deprecated classes for proper upper bound of the consumers of the target API, essentially following Postel's Law
  • Move ContainerUtilsTests to core module as we don't test a deprecated class any more
  • Add reactor-core optional dependency to core module to satisfy ContinuationHandlerMethodArgumentResolver requirements

Some exceptions and listener supporting classes
are not only for RabbitMQ integration.
They can be used in any other Spring AMQP implementations.

* Deprecate existing classes in favor of their new counterpart
with extensions where possible.
* Still use instances of deprecated classes for proper upper bound
of the consumers of the target API, essentially following Postel's Law
* Move `ContainerUtilsTests` to `core` module as we don't test a deprecated class any more
* Add `reactor-core` optional dependency to `core` module
to satisfy `ContinuationHandlerMethodArgumentResolver` requirements
@artembilan artembilan added this to the 4.1.0-M1 milestone Jan 15, 2026
@artembilan artembilan requested a review from cppwfs January 15, 2026 21:25
@artembilan
Copy link
Copy Markdown
Member Author

The PR is huge, but all those new classes are just moved from their old places.
The other changes are:

  • @Deprecated marks
  • @SuppressWarnings("removal") for a proper upper bound on consumers
  • Imports reorder for new place of the moved class
  • Some other automatic formatting suggested by IDE

Thanks

Copy link
Copy Markdown
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you!

public static boolean shouldRequeue(boolean defaultRequeueRejected, Throwable throwable, Log logger) {
boolean shouldRequeue = defaultRequeueRejected ||
throwable instanceof MessageRejectedWhileStoppingException;
Throwable t = throwable;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not use throwable instead of assigning it to t?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because we do t = cause; a bit bellow in the logic.
And good practice is not to mutate method argument.
Kinda treat all the method arguments as final.

this.failedMessages = new ArrayList<>(Arrays.asList(failedMessage));
}

public @Nullable Message getFailedMessage() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Feels like this should be getFirstFailedMessage

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That is how it was there for for years and I'm fully OK with this contract.
Mostly this exception is created with a single failed message.

@cppwfs cppwfs merged commit 7814652 into spring-projects:main Jan 16, 2026
3 checks passed
@artembilan artembilan deleted the common_apis branch January 19, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants