Reintroduce support for ActiveMQ

See gh-35048
This commit is contained in:
Martin BENDA
2023-03-30 08:38:36 +02:00
committed by Stephane Nicoll
parent bed11671d3
commit 3e9908a797
17 changed files with 965 additions and 3 deletions

View File

@@ -7,6 +7,55 @@ Spring Boot also auto-configures the necessary infrastructure to send and receiv
[[messaging.jms.activemq]]
=== ActiveMQ Support
When https://activemq.apache.org/[ActiveMQ] is available on the classpath, Spring Boot can also configure a `ConnectionFactory`.
NOTE: If you use `spring-boot-starter-activemq`, the necessary dependencies to connect to an ActiveMQ instance are provided, as is the Spring infrastructure to integrate with JMS.
ActiveMQ configuration is controlled by external configuration properties in `+spring.activemq.*+`.
By default, ActiveMQ is auto-configured to use the https://activemq.apache.org/tcp-transport-reference[TCP transport] eith the default broker URL `tcp://localhost:61616`.
The following example shows how to change the default broker URL:
[source,yaml,indent=0,configprops,configblocks]
----
spring:
activemq:
broker-url: "tcp://192.168.1.210:9876"
user: "admin"
password: "secret"
----
By default, a `CachingConnectionFactory` wraps the native `ConnectionFactory` with sensible settings that you can control by external configuration properties in `+spring.jms.*+`:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
jms:
cache:
session-cache-size: 5
----
If you'd rather use native pooling, you can do so by adding a dependency to `org.messaginghub:pooled-jms` and configuring the `JmsPoolConnectionFactory` accordingly, as shown in the following example:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
activemq:
pool:
enabled: true
max-connections: 50
----
TIP: See {spring-boot-autoconfigure-module-code}/jms/activemq/ActiveMQProperties.java[`ActiveMQProperties`] for more of the supported options.
You can also register an arbitrary number of beans that implement `ActiveMQConnectionFactoryCustomizer` for more advanced customizations.
By default, ActiveMQ creates a destination if it does not yet exist so that destinations are resolved against their provided names.
[[messaging.jms.artemis]]
=== ActiveMQ Artemis Support
Spring Boot can auto-configure a `ConnectionFactory` when it detects that https://activemq.apache.org/components/artemis/[ActiveMQ Artemis] is available on the classpath.