Reinstate auto-configuration support for embedded ActiveMQ
This commit restores auto-configuration for using an Embedded broker with ActiveMQ classic. Contrary to its 2.7.x version, "spring-boot-starter-activemq" no longer adds the broker for consistency with Artemis, and to keep the existing 3.x behavior. Rather than "inMemory", a "s.a.embedded.enabled" property has been reintroduced that matches the name used by Artemis. The documentation has been updated to mention that the broker dependency must be added to use it. Closes gh-38404
This commit is contained in:
@@ -12,11 +12,26 @@ Spring Boot also auto-configures the necessary infrastructure to send and receiv
|
||||
== ActiveMQ "Classic" Support
|
||||
|
||||
When https://activemq.apache.org/components/classic[ActiveMQ "Classic"] is available on the classpath, Spring Boot can configure a `ConnectionFactory`.
|
||||
If the broker is present, an embedded broker is automatically started and configured (provided no broker URL is specified through configuration and the embedded broker is not disabled in the configuration).
|
||||
|
||||
NOTE: If you use `spring-boot-starter-activemq`, the necessary dependencies to connect to an ActiveMQ "Classic" instance are provided, as is the Spring infrastructure to integrate with JMS.
|
||||
Adding `org.apache.activemq:activemq-broker` to your application lets you use the embedded broker.
|
||||
|
||||
ActiveMQ "Classic" configuration is controlled by external configuration properties in `+spring.activemq.*+`.
|
||||
By default, ActiveMQ "Classic" is auto-configured to use the https://activemq.apache.org/tcp-transport-reference[TCP transport], connecting by default to `tcp://localhost:61616`. The following example shows how to change the default broker URL:
|
||||
|
||||
If `activemq-broker` is on the classpath, ActiveMQ "Classic" is auto-configured to use the https://activemq.apache.org/vm-transport-reference.html[VM transport], which starts a broker embedded in the same JVM instance.
|
||||
|
||||
You can disable the embedded broker by configuring the configprop:spring.activemq.embedded.enabled[] property, as shown in the following example:
|
||||
|
||||
[configprops,yaml]
|
||||
----
|
||||
spring:
|
||||
activemq:
|
||||
embedded:
|
||||
enabled: false
|
||||
----
|
||||
|
||||
The embedded broker will also be disabled if you configure the broker URL, as shown in the following example:
|
||||
|
||||
[configprops,yaml]
|
||||
----
|
||||
@@ -27,6 +42,8 @@ spring:
|
||||
password: "secret"
|
||||
----
|
||||
|
||||
If you want to take full control over the embedded broker, see https://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html[the ActiveMQ "Classic" documentation] for further information.
|
||||
|
||||
By default, a `CachingConnectionFactory` wraps the native `ConnectionFactory` with sensible settings that you can control by external configuration properties in `+spring.jms.*+`:
|
||||
|
||||
[configprops,yaml]
|
||||
|
||||
Reference in New Issue
Block a user