Skip to content

Add support for RabbitMQ AMQP 1.0 #46608

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

eddumelendez
Copy link
Contributor

@eddumelendez eddumelendez commented Jul 31, 2025

  • Add support for RabbitMQ AMQP 1.0
  • Add smoke test for RabbitMQ AMQP 1.0

Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
@eddumelendez eddumelendez changed the title rabbitmq amqp Add support for Rabbitmq AMQP 1.0 Jul 31, 2025
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 31, 2025
Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
@eddumelendez eddumelendez changed the title Add support for Rabbitmq AMQP 1.0 Add support for RabbitMQ AMQP 1.0 Jul 31, 2025
@@ -41,6 +41,7 @@ dependencies {
optional(project(":module:spring-boot-metrics"))
optional("io.micrometer:micrometer-core")
optional("org.springframework.amqp:spring-rabbit-stream")
optional("org.springframework.amqp:spring-rabbitmq-client")
Copy link
Member

Choose a reason for hiding this comment

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

I think it is better to have an AMQP 1.0 as default one.
Therefore I suggest to do api("org.springframework.amqp:spring-rabbitmq-client") instead of that api("org.springframework.amqp:spring-rabbit").
The spring-rabbitmq-client has spring-rabbit as dependency.
So, both AMQP 1.0 and 0.9.1 are on classpath.
but that should be end-user choice to opt-in to 0.9.1 by excluding spring-rabbitmq-client auto-configuration or so.
I mean this is Spring Boot 4.0 and we probably can bite a bullet and make AMQP 1.0 auto-configured by default.

Just my opinion: we can continue discussion.

Copy link
Member

Choose a reason for hiding this comment

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

Any comments why this was not addressed?
I think spring-boot-starter-amqp as it is right now, but definitely aimed for AMQP 1.0.
For previous behavior for AMQP 0.9.1, we would need to introduce a new starter - spring-boot-starter-rabbitmq.
There we would exclude this new spring-rabbitmq-client and declare that old spring-rabbit.

But that's my opinion: probably we would need some input from Spring Boot team.

private RabbitAmqpTemplate rabbitAmqpTemplate;

public void send(String message) {
this.rabbitAmqpTemplate.convertAndSend("foo", message);
Copy link
Member

Choose a reason for hiding this comment

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

Is foo/bar language OK with Spring Boot team?

* @author Eddú Meléndez
* @since 4.0.0
*/
@AutoConfiguration
Copy link
Member

Choose a reason for hiding this comment

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

I think need to make before = RabbitAutoConfiguration.class and make that one conditional on something missing from this RabbitAmqpAutoConfiguration.
This is an addition to my previous point: the AMQP 1.0 is by default.
If we don't make them conditional on each other, then both protocols are going to be enabled and connected.
Especially, I worry about RabbitAmqpAdmin and RabbitAdmin which are going to handle topology in parallel but in different connections.
I don't think that we need to give a choice to be able to have both protocols in one Spring Boot application.


private final RabbitProperties properties;

RabbitAmqpAutoConfiguration(RabbitProperties properties) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to look into a separate RabbitAmqpProperties abstraction.
Even if some duplication is possible, a bunch of existing properties are not going to be used for AMQP 1.0 at all.
And might cause confusion.

Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
* @author Eddú Meléndez
* @since 4.0.0
*/
@AutoConfiguration(before = RabbitAutoConfiguration.class)
Copy link
Member

Choose a reason for hiding this comment

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

Any comments why no @ConditionalOnMissingBean on that RabbitAutoConfiguration?
We should aim to not auto-configure AMQP 0.9.1, if we got AMQP 1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants