Skip to content

Commit f48cc3a

Browse files
committed
Move Spring AMQP 0.9 support to spring-boot-rabbitmq
Now that Spring AMQP supports AMQP 1.0 as well, we need to straighten out our existing support. AMQP 0.9 is RabbitMQ specific, so we can no longer refer it to "amqp". This commit migrates the existing support to spring-boot-rabbitmq and renames the starters as well. For continuity, users should migrate from "spring-boot-starter-amqp" to "spring-boot-starter-rabbitmq". While the root package has been changed for consistency, most names are the same, including configuration properties still in the "spring.rabbitmq" namespace. Keys to configure the version of the RabbitMQ clients have migrated to 'rabbitmq.client' and 'rabbitmq.stream.client' respectively. Closes gh-49677
1 parent 467fde1 commit f48cc3a

110 files changed

Lines changed: 286 additions & 284 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

documentation/spring-boot-docs/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ dependencies {
9494
implementation(project(path: ":loader:spring-boot-loader-tools"))
9595
implementation(project(path: ":module:spring-boot-actuator"))
9696
implementation(project(path: ":module:spring-boot-actuator-autoconfigure"))
97-
implementation(project(path: ":module:spring-boot-amqp"))
9897
implementation(project(path: ":module:spring-boot-cache"))
9998
implementation(project(path: ":module:spring-boot-cache-test"))
10099
implementation(project(path: ":module:spring-boot-data-cassandra"))
@@ -130,6 +129,7 @@ dependencies {
130129
implementation(project(path: ":module:spring-boot-micrometer-metrics"))
131130
implementation(project(path: ":module:spring-boot-persistence"))
132131
implementation(project(path: ":module:spring-boot-r2dbc"))
132+
implementation(project(path: ":module:spring-boot-rabbitmq"))
133133
implementation(project(path: ":module:spring-boot-restdocs"))
134134
implementation(project(path: ":module:spring-boot-reactor-netty"))
135135
implementation(project(path: ":module:spring-boot-restclient"))

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/actuator/endpoints.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ with the `key` listed in the following table:
673673
| Always responds with `UP`.
674674

675675
| `rabbit`
676-
| javadoc:org.springframework.boot.amqp.health.RabbitHealthIndicator[]
676+
| javadoc:org.springframework.boot.rabbitmq.health.RabbitHealthIndicator[]
677677
| Checks that a Rabbit server is up.
678678

679679
| `redis`

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/features/dev-services.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ The following service connections are currently supported:
125125
| javadoc:org.springframework.boot.r2dbc.autoconfigure.R2dbcConnectionDetails[]
126126
| Containers named "clickhouse/clickhouse-server", "gvenzl/oracle-free", "gvenzl/oracle-xe", "mariadb", "mssql/server", "mysql", or "postgres"
127127

128-
| javadoc:org.springframework.boot.amqp.autoconfigure.RabbitConnectionDetails[]
128+
| javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitConnectionDetails[]
129129
| Containers named "rabbitmq" with container port 5672 mapped
130130

131-
| javadoc:org.springframework.boot.amqp.autoconfigure.RabbitStreamConnectionDetails[]
131+
| javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails[]
132132
| Containers named "rabbitmq" with container port 5552 mapped, or port 5551 mapped when SSL is configured
133133

134134
| javadoc:org.springframework.boot.data.redis.autoconfigure.DataRedisConnectionDetails[]

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/messaging/amqp.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
The Advanced Message Queuing Protocol (AMQP) is a platform-neutral, wire-level protocol for message-oriented middleware.
55
The Spring AMQP project applies core Spring concepts to the development of AMQP-based messaging solutions.
6-
Spring Boot offers several conveniences for working with AMQP through RabbitMQ, including the `spring-boot-starter-amqp` starter.
6+
Spring Boot offers several conveniences for working with AMQP through RabbitMQ, including the `spring-boot-starter-rabbitmq` starter.
77

88

99

@@ -38,12 +38,12 @@ spring:
3838
NOTE: When specifying addresses that way, the `host` and `port` properties are ignored.
3939
If the address uses the `amqps` protocol, SSL support is enabled automatically.
4040

41-
See javadoc:org.springframework.boot.amqp.autoconfigure.RabbitProperties[] for more of the supported property-based configuration options.
42-
To configure lower-level details of the RabbitMQ javadoc:com.rabbitmq.client.ConnectionFactory[] that is used by Spring AMQP, define a javadoc:org.springframework.boot.amqp.autoconfigure.ConnectionFactoryCustomizer[] bean.
41+
See javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitProperties[] for more of the supported property-based configuration options.
42+
To configure lower-level details of the RabbitMQ javadoc:com.rabbitmq.client.ConnectionFactory[] that is used by Spring AMQP, define a javadoc:org.springframework.boot.rabbitmq.autoconfigure.ConnectionFactoryCustomizer[] bean.
4343

4444
If a javadoc:org.springframework.amqp.rabbit.connection.ConnectionNameStrategy[] bean exists in the context, it will be automatically used to name connections created by the auto-configured javadoc:org.springframework.amqp.rabbit.connection.CachingConnectionFactory[].
4545

46-
To make an application-wide, additive customization to the javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[], use a javadoc:org.springframework.boot.amqp.autoconfigure.RabbitTemplateCustomizer[] bean.
46+
To make an application-wide, additive customization to the javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[], use a javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitTemplateCustomizer[] bean.
4747

4848
TIP: See https://spring.io/blog/2010/06/14/understanding-amqp-the-protocol-used-by-rabbitmq/[Understanding AMQP, the protocol used by RabbitMQ] for more details.
4949

@@ -74,9 +74,9 @@ spring:
7474
----
7575

7676
Retries are disabled by default.
77-
You can also customize the javadoc:org.springframework.core.retry.RetryTemplate[] programmatically by declaring a javadoc:org.springframework.boot.amqp.autoconfigure.RabbitTemplateRetrySettingsCustomizer[] bean.
77+
You can also customize the javadoc:org.springframework.core.retry.RetryTemplate[] programmatically by declaring a javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitTemplateRetrySettingsCustomizer[] bean.
7878

79-
If you need to create more javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[] instances or if you want to override the default, Spring Boot provides a javadoc:org.springframework.boot.amqp.autoconfigure.RabbitTemplateConfigurer[] bean that you can use to initialize a javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[] with the same settings as the factories used by the auto-configuration.
79+
If you need to create more javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[] instances or if you want to override the default, Spring Boot provides a javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitTemplateConfigurer[] bean that you can use to initialize a javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[] with the same settings as the factories used by the auto-configuration.
8080

8181
If there's a bean of type javadoc:org.springframework.amqp.rabbit.support.micrometer.RabbitTemplateObservationConvention[] in the context, it will automatically be configured on the javadoc:org.springframework.amqp.rabbit.core.RabbitTemplate[].
8282

@@ -97,7 +97,7 @@ spring:
9797

9898
If a javadoc:org.springframework.amqp.support.converter.MessageConverter[], javadoc:org.springframework.rabbit.stream.support.converter.StreamMessageConverter[], javadoc:org.springframework.rabbit.stream.producer.ProducerCustomizer[] or javadoc:org.springframework.rabbit.stream.micrometer.RabbitStreamTemplateObservationConvention[] bean is defined, it is associated automatically to the auto-configured javadoc:org.springframework.rabbit.stream.producer.RabbitStreamTemplate[].
9999

100-
If you need to create more javadoc:org.springframework.rabbit.stream.producer.RabbitStreamTemplate[] instances or if you want to override the default, Spring Boot provides a javadoc:org.springframework.boot.amqp.autoconfigure.RabbitStreamTemplateConfigurer[] bean that you can use to initialize a javadoc:org.springframework.rabbit.stream.producer.RabbitStreamTemplate[] with the same settings as the factories used by the auto-configuration.
100+
If you need to create more javadoc:org.springframework.rabbit.stream.producer.RabbitStreamTemplate[] instances or if you want to override the default, Spring Boot provides a javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamTemplateConfigurer[] bean that you can use to initialize a javadoc:org.springframework.rabbit.stream.producer.RabbitStreamTemplate[] with the same settings as the factories used by the auto-configuration.
101101

102102

103103

@@ -120,7 +120,7 @@ include-code::MyBean[]
120120

121121
TIP: See javadoc:org.springframework.amqp.rabbit.annotation.EnableRabbit[format=annotation] for more details.
122122

123-
If you need to create more javadoc:org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory[] instances or if you want to override the default, Spring Boot provides a javadoc:org.springframework.boot.amqp.autoconfigure.SimpleRabbitListenerContainerFactoryConfigurer[] and a javadoc:org.springframework.boot.amqp.autoconfigure.DirectRabbitListenerContainerFactoryConfigurer[] that you can use to initialize a javadoc:org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory[] and a javadoc:org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory[] with the same settings as the factories used by the auto-configuration.
123+
If you need to create more javadoc:org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory[] instances or if you want to override the default, Spring Boot provides a javadoc:org.springframework.boot.rabbitmq.autoconfigure.SimpleRabbitListenerContainerFactoryConfigurer[] and a javadoc:org.springframework.boot.rabbitmq.autoconfigure.DirectRabbitListenerContainerFactoryConfigurer[] that you can use to initialize a javadoc:org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory[] and a javadoc:org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory[] with the same settings as the factories used by the auto-configuration.
124124

125125
TIP: It does not matter which container type you chose.
126126
Those two beans are exposed by the auto-configuration.
@@ -137,7 +137,7 @@ You can enable retries to handle situations where your listener throws an except
137137
By default, javadoc:org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer[] is used, but you can define a javadoc:org.springframework.amqp.rabbit.retry.MessageRecoverer[] of your own.
138138
When retries are exhausted, the message is rejected and either dropped or routed to a dead-letter exchange if the broker is configured to do so.
139139
By default, retries are disabled.
140-
You can also customize the javadoc:org.springframework.core.retry.RetryPolicy[] programmatically by declaring a javadoc:org.springframework.boot.amqp.autoconfigure.RabbitListenerRetrySettingsCustomizer[] bean.
140+
You can also customize the javadoc:org.springframework.core.retry.RetryPolicy[] programmatically by declaring a javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitListenerRetrySettingsCustomizer[] bean.
141141

142142
IMPORTANT: By default, if retries are disabled and the listener throws an exception, the delivery is retried indefinitely.
143143
You can modify this behavior in two ways: Set the `defaultRequeueRejected` property to `false` so that zero re-deliveries are attempted or throw an javadoc:org.springframework.amqp.AmqpRejectAndDontRequeueException[] to signal the message should be rejected.

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/testcontainers.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ javadoc:org.testcontainers.clickhouse.ClickHouseContainer[],
179179
javadoc:{url-testcontainers-mariadb-javadoc}/org.testcontainers.mariadb.MariaDBContainer[], javadoc:{url-testcontainers-mssqlserver-javadoc}/org.testcontainers.mssqlserver.MSSQLServerContainer[], javadoc:{url-testcontainers-mysql-javadoc}/org.testcontainers.mysql.MySQLContainer[],
180180
javadoc:org.testcontainers.oracle.OracleContainer[OracleContainer (free)], javadoc:{url-testcontainers-oracle-xe-javadoc}/org.testcontainers.containers.OracleContainer[OracleContainer (XE)] or javadoc:{url-testcontainers-postgresql-javadoc}/org.testcontainers.postgresql.PostgreSQLContainer[]
181181

182-
| javadoc:org.springframework.boot.amqp.autoconfigure.RabbitConnectionDetails[]
182+
| javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitConnectionDetails[]
183183
| Containers of type javadoc:{url-testcontainers-rabbitmq-javadoc}/org.testcontainers.rabbitmq.RabbitMQContainer[]
184184

185-
| javadoc:org.springframework.boot.amqp.autoconfigure.RabbitStreamConnectionDetails[]
186-
| Containers of type javadoc:{url-testcontainers-rabbitmq-javadoc}/org.testcontainers.rabbitmq.RabbitMQContainer[] when the `@ServiceConnection` `type` attribute includes javadoc:org.springframework.boot.amqp.autoconfigure.RabbitStreamConnectionDetails[]
185+
| javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails[]
186+
| Containers of type javadoc:{url-testcontainers-rabbitmq-javadoc}/org.testcontainers.rabbitmq.RabbitMQContainer[] when the `@ServiceConnection` `type` attribute includes javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails[]
187187

188188
| javadoc:org.springframework.boot.data.redis.autoconfigure.DataRedisConnectionDetails[]
189189
| Containers of type javadoc:com.redis.testcontainers.RedisContainer[] or javadoc:com.redis.testcontainers.RedisStackContainer[], or containers named "redis", "redis/redis-stack" or "redis/redis-stack-server"
@@ -194,12 +194,12 @@ javadoc:org.testcontainers.oracle.OracleContainer[OracleContainer (free)], javad
194194

195195
[TIP]
196196
====
197-
By default, with the exception of javadoc:org.springframework.boot.amqp.autoconfigure.RabbitStreamConnectionDetails[], all applicable connection details beans will be created for a given javadoc:org.testcontainers.containers.Container[].
197+
By default, with the exception of javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails[], all applicable connection details beans will be created for a given javadoc:org.testcontainers.containers.Container[].
198198
For example, a javadoc:{url-testcontainers-postgresql-javadoc}/org.testcontainers.postgresql.PostgreSQLContainer[] will create both javadoc:org.springframework.boot.jdbc.autoconfigure.JdbcConnectionDetails[] and javadoc:org.springframework.boot.r2dbc.autoconfigure.R2dbcConnectionDetails[].
199199
200200
If you want to create only a subset of the applicable types, you can use the `type` attribute of javadoc:org.springframework.boot.testcontainers.service.connection.ServiceConnection[format=annotation].
201201
202-
To create a javadoc:org.springframework.boot.amqp.autoconfigure.RabbitStreamConnectionDetails[] bean from a javadoc:{url-testcontainers-rabbitmq-javadoc}/org.testcontainers.rabbitmq.RabbitMQContainer[], you must opt in using the `type` attribute of javadoc:org.springframework.boot.testcontainers.service.connection.ServiceConnection[format=annotation].
202+
To create a javadoc:org.springframework.boot.rabbitmq.autoconfigure.RabbitStreamConnectionDetails[] bean from a javadoc:{url-testcontainers-rabbitmq-javadoc}/org.testcontainers.rabbitmq.RabbitMQContainer[], you must opt in using the `type` attribute of javadoc:org.springframework.boot.testcontainers.service.connection.ServiceConnection[format=annotation].
203203
The container must also expose port 5552, or port 5551 when SSL is configured, for RabbitMQ Streams.
204204
====
205205

documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/messaging/amqp/receiving/custom/MyRabbitConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
2020
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
21-
import org.springframework.boot.amqp.autoconfigure.SimpleRabbitListenerContainerFactoryConfigurer;
21+
import org.springframework.boot.rabbitmq.autoconfigure.SimpleRabbitListenerContainerFactoryConfigurer;
2222
import org.springframework.context.annotation.Bean;
2323
import org.springframework.context.annotation.Configuration;
2424

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/messaging/amqp/receiving/custom/MyRabbitConfiguration.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.springframework.boot.docs.messaging.amqp.receiving.custom
1919
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory
2020
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory
2121
import org.springframework.amqp.rabbit.connection.ConnectionFactory
22-
import org.springframework.boot.amqp.autoconfigure.SimpleRabbitListenerContainerFactoryConfigurer
22+
import org.springframework.boot.rabbitmq.autoconfigure.SimpleRabbitListenerContainerFactoryConfigurer
2323
import org.springframework.context.annotation.Bean
2424
import org.springframework.context.annotation.Configuration
2525

module/spring-boot-amqp/src/main/resources/META-INF/spring.factories

Lines changed: 0 additions & 8 deletions
This file was deleted.

module/spring-boot-amqp/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Lines changed: 0 additions & 3 deletions
This file was deleted.

module/spring-boot-autoconfigure-classic-modules/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ dependencies {
2828
api(project(":module:spring-boot-activemq")) {
2929
transitive = false
3030
}
31-
api(project(":module:spring-boot-amqp")) {
32-
transitive = false
33-
}
3431
api(project(":module:spring-boot-artemis")) {
3532
transitive = false
3633
}
@@ -226,6 +223,9 @@ dependencies {
226223
api(project(":module:spring-boot-r2dbc")) {
227224
transitive = false
228225
}
226+
api(project(":module:spring-boot-rabbitmq")) {
227+
transitive = false
228+
}
229229
api(project(":module:spring-boot-reactor")) {
230230
transitive = false
231231
}

0 commit comments

Comments
 (0)