Add support for JMS session caching
This commit adds support for CachingConnectionFactory for both Artemis and ActiveMQ. If connection pooling is not enabled explicitly, sessions, producers and consumers are cached. The factory can be further customized, including reverting to the raw ConnectionFactory, using the `spring.jms.*` namespace. Closes gh-12161
This commit is contained in:
@@ -995,6 +995,10 @@ content into your application. Rather, pick only the properties that you need.
|
||||
spring.integration.jdbc.schema=classpath:org/springframework/integration/jdbc/schema-@@platform@@.sql # Path to the SQL file to use to initialize the database schema.
|
||||
|
||||
# JMS ({sc-spring-boot-autoconfigure}/jms/JmsProperties.{sc-ext}[JmsProperties])
|
||||
spring.jms.cache.consumers=false # Whether to cache message consumers.
|
||||
spring.jms.cache.enabled=true # Whether to cache sessions.
|
||||
spring.jms.cache.producers=true # Whether to cache message producers.
|
||||
spring.jms.cache.session-cache-size=1 # Size of the session cache (per JMS Session type).
|
||||
spring.jms.jndi-name= # Connection factory JNDI name. When set, takes precedence to others connection factory auto-configurations.
|
||||
spring.jms.listener.acknowledge-mode= # Acknowledge mode of the container. By default, the listener is transacted with automatic acknowledgment.
|
||||
spring.jms.listener.auto-startup=true # Start the container automatically on startup.
|
||||
|
||||
@@ -5065,7 +5065,16 @@ ActiveMQ configuration is controlled by external configuration properties in
|
||||
spring.activemq.password=secret
|
||||
----
|
||||
|
||||
You can also pool JMS resources by adding a dependency to
|
||||
By default, a `CachingConnectionFactory` wraps the native `ConnectionFactory` with
|
||||
sensible settings that you can control by external configuration properties in
|
||||
`+spring.jms.*+`:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.jms.cache.session-cache-size=5
|
||||
----
|
||||
|
||||
If you'd rather use native pooling, you can do so by adding a dependency to
|
||||
`org.apache.activemq:activemq-jms-pool` and configuring the `PooledConnectionFactory`
|
||||
accordingly, as shown in the following example:
|
||||
|
||||
@@ -5122,7 +5131,16 @@ list to create them with the default options, or you can define bean(s) of type
|
||||
`org.apache.activemq.artemis.jms.server.config.TopicConfiguration`, for advanced queue
|
||||
and topic configurations, respectively.
|
||||
|
||||
You can also pool JMS resources by adding a dependency to
|
||||
By default, a `CachingConnectionFactory` wraps the native `ConnectionFactory` with
|
||||
sensible settings that you can control by external configuration properties in
|
||||
`+spring.jms.*+`:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.jms.cache.session-cache-size=5
|
||||
----
|
||||
|
||||
If you'd rather use native pooling, you can do so by adding a dependency to
|
||||
`org.apache.activemq:activemq-jms-pool` and configuring the `PooledConnectionFactory`
|
||||
accordingly, as shown in the following example:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user