Add support for connection pooling with Artemis

This commit expands ActiveMQ's connection pooling to artemis. The same
pooling features are now shared by the two brokers and a
PooledConnectionFactory can be auto-configured when the necessary jar is
present.

Closes gh-13523
This commit is contained in:
Stephane Nicoll
2018-06-06 14:44:26 +02:00
parent 28c1bc9986
commit 0ef54a79b1
11 changed files with 413 additions and 195 deletions

View File

@@ -969,6 +969,17 @@ content into your application. Rather, pick only the properties that you need.
spring.artemis.host=localhost # Artemis broker host.
spring.artemis.mode= # Artemis deployment mode, auto-detected by default.
spring.artemis.password= # Login password of the broker.
spring.artemis.pool.block-if-full=true # Whether to block when a connection is requested and the pool is full. Set it to false to throw a "JMSException" instead.
spring.artemis.pool.block-if-full-timeout=-1ms # Blocking period before throwing an exception if the pool is still full.
spring.artemis.pool.create-connection-on-startup=true # Whether to create a connection on startup. Can be used to warm up the pool on startup.
spring.artemis.pool.enabled=false # Whether a PooledConnectionFactory should be created, instead of a regular ConnectionFactory.
spring.artemis.pool.expiry-timeout=0ms # Connection expiration timeout.
spring.artemis.pool.idle-timeout=30s # Connection idle timeout.
spring.artemis.pool.max-connections=1 # Maximum number of pooled connections.
spring.artemis.pool.maximum-active-session-per-connection=500 # Maximum number of active sessions per connection.
spring.artemis.pool.reconnect-on-exception=true # Reset the connection when a "JMSException" occurs.
spring.artemis.pool.time-between-expiration-check=-1ms # Time to sleep between runs of the idle connection eviction thread. When negative, no idle connection eviction thread runs.
spring.artemis.pool.use-anonymous-producers=true # Whether to use only one anonymous "MessageProducer" instance. Set it to false to create one "MessageProducer" every time one is required.
spring.artemis.port=61616 # Artemis broker port.
spring.artemis.user= # Login user of the broker.

View File

@@ -5066,7 +5066,7 @@ ActiveMQ configuration is controlled by external configuration properties in
----
You can also pool JMS resources by adding a dependency to
`org.apache.activemq:activemq-pool` and configuring the `PooledConnectionFactory`
`org.apache.activemq:activemq-jms-pool` and configuring the `PooledConnectionFactory`
accordingly, as shown in the following example:
[source,properties,indent=0]
@@ -5122,6 +5122,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
`org.apache.activemq:activemq-jms-pool` and configuring the `PooledConnectionFactory`
accordingly, as shown in the following example:
[source,properties,indent=0]
----
spring.artemis.pool.enabled=true
spring.artemis.pool.max-connections=50
----
See
{sc-spring-boot-autoconfigure}/jms/artemis/ArtemisProperties.{sc-ext}[`ArtemisProperties`]
for more supported options.