Merge branch '2.0.x'
This commit is contained in:
		
						commit
						fbf95b6997
					
				| 
						 | 
					@ -52,12 +52,6 @@ public class PooledConnectionFactoryFactory {
 | 
				
			||||||
			pooledConnectionFactory.setBlockIfSessionPoolIsFullTimeout(
 | 
								pooledConnectionFactory.setBlockIfSessionPoolIsFullTimeout(
 | 
				
			||||||
					this.properties.getBlockIfFullTimeout().toMillis());
 | 
										this.properties.getBlockIfFullTimeout().toMillis());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		pooledConnectionFactory.setCreateConnectionOnStartup(
 | 
					 | 
				
			||||||
				this.properties.isCreateConnectionOnStartup());
 | 
					 | 
				
			||||||
		if (this.properties.getExpiryTimeout() != null) {
 | 
					 | 
				
			||||||
			pooledConnectionFactory
 | 
					 | 
				
			||||||
					.setExpiryTimeout(this.properties.getExpiryTimeout().toMillis());
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if (this.properties.getIdleTimeout() != null) {
 | 
							if (this.properties.getIdleTimeout() != null) {
 | 
				
			||||||
			pooledConnectionFactory
 | 
								pooledConnectionFactory
 | 
				
			||||||
					.setIdleTimeout((int) this.properties.getIdleTimeout().toMillis());
 | 
										.setIdleTimeout((int) this.properties.getIdleTimeout().toMillis());
 | 
				
			||||||
| 
						 | 
					@ -65,8 +59,6 @@ public class PooledConnectionFactoryFactory {
 | 
				
			||||||
		pooledConnectionFactory.setMaxConnections(this.properties.getMaxConnections());
 | 
							pooledConnectionFactory.setMaxConnections(this.properties.getMaxConnections());
 | 
				
			||||||
		pooledConnectionFactory.setMaximumActiveSessionPerConnection(
 | 
							pooledConnectionFactory.setMaximumActiveSessionPerConnection(
 | 
				
			||||||
				this.properties.getMaximumActiveSessionPerConnection());
 | 
									this.properties.getMaximumActiveSessionPerConnection());
 | 
				
			||||||
		pooledConnectionFactory
 | 
					 | 
				
			||||||
				.setReconnectOnException(this.properties.isReconnectOnException());
 | 
					 | 
				
			||||||
		if (this.properties.getTimeBetweenExpirationCheck() != null) {
 | 
							if (this.properties.getTimeBetweenExpirationCheck() != null) {
 | 
				
			||||||
			pooledConnectionFactory.setTimeBetweenExpirationCheckMillis(
 | 
								pooledConnectionFactory.setTimeBetweenExpirationCheckMillis(
 | 
				
			||||||
					this.properties.getTimeBetweenExpirationCheck().toMillis());
 | 
										this.properties.getTimeBetweenExpirationCheck().toMillis());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,17 +43,6 @@ public class PooledConnectionFactoryProperties {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private Duration blockIfFullTimeout = Duration.ofMillis(-1);
 | 
						private Duration blockIfFullTimeout = Duration.ofMillis(-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Whether to create a connection on startup. Can be used to warm up the pool on
 | 
					 | 
				
			||||||
	 * startup.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	private boolean createConnectionOnStartup = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Connection expiration timeout.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	private Duration expiryTimeout = Duration.ofMillis(0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Connection idle timeout.
 | 
						 * Connection idle timeout.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
| 
						 | 
					@ -69,11 +58,6 @@ public class PooledConnectionFactoryProperties {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private int maximumActiveSessionPerConnection = 500;
 | 
						private int maximumActiveSessionPerConnection = 500;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Reset the connection when a "JMSException" occurs.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	private boolean reconnectOnException = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Time to sleep between runs of the idle connection eviction thread. When negative,
 | 
						 * Time to sleep between runs of the idle connection eviction thread. When negative,
 | 
				
			||||||
	 * no idle connection eviction thread runs.
 | 
						 * no idle connection eviction thread runs.
 | 
				
			||||||
| 
						 | 
					@ -110,22 +94,6 @@ public class PooledConnectionFactoryProperties {
 | 
				
			||||||
		this.blockIfFullTimeout = blockIfFullTimeout;
 | 
							this.blockIfFullTimeout = blockIfFullTimeout;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public boolean isCreateConnectionOnStartup() {
 | 
					 | 
				
			||||||
		return this.createConnectionOnStartup;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void setCreateConnectionOnStartup(boolean createConnectionOnStartup) {
 | 
					 | 
				
			||||||
		this.createConnectionOnStartup = createConnectionOnStartup;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Duration getExpiryTimeout() {
 | 
					 | 
				
			||||||
		return this.expiryTimeout;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void setExpiryTimeout(Duration expiryTimeout) {
 | 
					 | 
				
			||||||
		this.expiryTimeout = expiryTimeout;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Duration getIdleTimeout() {
 | 
						public Duration getIdleTimeout() {
 | 
				
			||||||
		return this.idleTimeout;
 | 
							return this.idleTimeout;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -151,14 +119,6 @@ public class PooledConnectionFactoryProperties {
 | 
				
			||||||
		this.maximumActiveSessionPerConnection = maximumActiveSessionPerConnection;
 | 
							this.maximumActiveSessionPerConnection = maximumActiveSessionPerConnection;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public boolean isReconnectOnException() {
 | 
					 | 
				
			||||||
		return this.reconnectOnException;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void setReconnectOnException(boolean reconnectOnException) {
 | 
					 | 
				
			||||||
		this.reconnectOnException = reconnectOnException;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Duration getTimeBetweenExpirationCheck() {
 | 
						public Duration getTimeBetweenExpirationCheck() {
 | 
				
			||||||
		return this.timeBetweenExpirationCheck;
 | 
							return this.timeBetweenExpirationCheck;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -179,10 +179,6 @@ public class ActiveMQAutoConfigurationTests {
 | 
				
			||||||
					assertThat(connectionFactory.getBlockIfSessionPoolIsFullTimeout())
 | 
										assertThat(connectionFactory.getBlockIfSessionPoolIsFullTimeout())
 | 
				
			||||||
							.isEqualTo(
 | 
												.isEqualTo(
 | 
				
			||||||
									defaultFactory.getBlockIfSessionPoolIsFullTimeout());
 | 
														defaultFactory.getBlockIfSessionPoolIsFullTimeout());
 | 
				
			||||||
					assertThat(connectionFactory.isCreateConnectionOnStartup())
 | 
					 | 
				
			||||||
							.isEqualTo(defaultFactory.isCreateConnectionOnStartup());
 | 
					 | 
				
			||||||
					assertThat(connectionFactory.getExpiryTimeout())
 | 
					 | 
				
			||||||
							.isEqualTo(defaultFactory.getExpiryTimeout());
 | 
					 | 
				
			||||||
					assertThat(connectionFactory.getIdleTimeout())
 | 
										assertThat(connectionFactory.getIdleTimeout())
 | 
				
			||||||
							.isEqualTo(defaultFactory.getIdleTimeout());
 | 
												.isEqualTo(defaultFactory.getIdleTimeout());
 | 
				
			||||||
					assertThat(connectionFactory.getMaxConnections())
 | 
										assertThat(connectionFactory.getMaxConnections())
 | 
				
			||||||
| 
						 | 
					@ -190,8 +186,6 @@ public class ActiveMQAutoConfigurationTests {
 | 
				
			||||||
					assertThat(connectionFactory.getMaximumActiveSessionPerConnection())
 | 
										assertThat(connectionFactory.getMaximumActiveSessionPerConnection())
 | 
				
			||||||
							.isEqualTo(defaultFactory
 | 
												.isEqualTo(defaultFactory
 | 
				
			||||||
									.getMaximumActiveSessionPerConnection());
 | 
														.getMaximumActiveSessionPerConnection());
 | 
				
			||||||
					assertThat(connectionFactory.isReconnectOnException())
 | 
					 | 
				
			||||||
							.isEqualTo(defaultFactory.isReconnectOnException());
 | 
					 | 
				
			||||||
					assertThat(connectionFactory.getTimeBetweenExpirationCheckMillis())
 | 
										assertThat(connectionFactory.getTimeBetweenExpirationCheckMillis())
 | 
				
			||||||
							.isEqualTo(
 | 
												.isEqualTo(
 | 
				
			||||||
									defaultFactory.getTimeBetweenExpirationCheckMillis());
 | 
														defaultFactory.getTimeBetweenExpirationCheckMillis());
 | 
				
			||||||
| 
						 | 
					@ -206,12 +200,9 @@ public class ActiveMQAutoConfigurationTests {
 | 
				
			||||||
				.withPropertyValues("spring.activemq.pool.enabled=true",
 | 
									.withPropertyValues("spring.activemq.pool.enabled=true",
 | 
				
			||||||
						"spring.activemq.pool.blockIfFull=false",
 | 
											"spring.activemq.pool.blockIfFull=false",
 | 
				
			||||||
						"spring.activemq.pool.blockIfFullTimeout=64",
 | 
											"spring.activemq.pool.blockIfFullTimeout=64",
 | 
				
			||||||
						"spring.activemq.pool.createConnectionOnStartup=false",
 | 
					 | 
				
			||||||
						"spring.activemq.pool.expiryTimeout=4096",
 | 
					 | 
				
			||||||
						"spring.activemq.pool.idleTimeout=512",
 | 
											"spring.activemq.pool.idleTimeout=512",
 | 
				
			||||||
						"spring.activemq.pool.maxConnections=256",
 | 
											"spring.activemq.pool.maxConnections=256",
 | 
				
			||||||
						"spring.activemq.pool.maximumActiveSessionPerConnection=1024",
 | 
											"spring.activemq.pool.maximumActiveSessionPerConnection=1024",
 | 
				
			||||||
						"spring.activemq.pool.reconnectOnException=false",
 | 
					 | 
				
			||||||
						"spring.activemq.pool.timeBetweenExpirationCheck=2048",
 | 
											"spring.activemq.pool.timeBetweenExpirationCheck=2048",
 | 
				
			||||||
						"spring.activemq.pool.useAnonymousProducers=false")
 | 
											"spring.activemq.pool.useAnonymousProducers=false")
 | 
				
			||||||
				.run((context) -> {
 | 
									.run((context) -> {
 | 
				
			||||||
| 
						 | 
					@ -222,13 +213,10 @@ public class ActiveMQAutoConfigurationTests {
 | 
				
			||||||
					assertThat(connectionFactory.isBlockIfSessionPoolIsFull()).isFalse();
 | 
										assertThat(connectionFactory.isBlockIfSessionPoolIsFull()).isFalse();
 | 
				
			||||||
					assertThat(connectionFactory.getBlockIfSessionPoolIsFullTimeout())
 | 
										assertThat(connectionFactory.getBlockIfSessionPoolIsFullTimeout())
 | 
				
			||||||
							.isEqualTo(64);
 | 
												.isEqualTo(64);
 | 
				
			||||||
					assertThat(connectionFactory.isCreateConnectionOnStartup()).isFalse();
 | 
					 | 
				
			||||||
					assertThat(connectionFactory.getExpiryTimeout()).isEqualTo(4096);
 | 
					 | 
				
			||||||
					assertThat(connectionFactory.getIdleTimeout()).isEqualTo(512);
 | 
										assertThat(connectionFactory.getIdleTimeout()).isEqualTo(512);
 | 
				
			||||||
					assertThat(connectionFactory.getMaxConnections()).isEqualTo(256);
 | 
										assertThat(connectionFactory.getMaxConnections()).isEqualTo(256);
 | 
				
			||||||
					assertThat(connectionFactory.getMaximumActiveSessionPerConnection())
 | 
										assertThat(connectionFactory.getMaximumActiveSessionPerConnection())
 | 
				
			||||||
							.isEqualTo(1024);
 | 
												.isEqualTo(1024);
 | 
				
			||||||
					assertThat(connectionFactory.isReconnectOnException()).isFalse();
 | 
					 | 
				
			||||||
					assertThat(connectionFactory.getTimeBetweenExpirationCheckMillis())
 | 
										assertThat(connectionFactory.getTimeBetweenExpirationCheckMillis())
 | 
				
			||||||
							.isEqualTo(2048);
 | 
												.isEqualTo(2048);
 | 
				
			||||||
					assertThat(connectionFactory.isUseAnonymousProducers()).isFalse();
 | 
										assertThat(connectionFactory.isUseAnonymousProducers()).isFalse();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -962,13 +962,10 @@ content into your application. Rather, pick only the properties that you need.
 | 
				
			||||||
	spring.activemq.packages.trusted= # Comma-separated list of specific packages to trust (when not trusting all packages).
 | 
						spring.activemq.packages.trusted= # Comma-separated list of specific packages to trust (when not trusting all packages).
 | 
				
			||||||
	spring.activemq.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.activemq.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.activemq.pool.block-if-full-timeout=-1ms # Blocking period before throwing an exception if the pool is still full.
 | 
						spring.activemq.pool.block-if-full-timeout=-1ms # Blocking period before throwing an exception if the pool is still full.
 | 
				
			||||||
	spring.activemq.pool.create-connection-on-startup=true # Whether to create a connection on startup. Can be used to warm up the pool on startup.
 | 
					 | 
				
			||||||
	spring.activemq.pool.enabled=false # Whether a PooledConnectionFactory should be created, instead of a regular ConnectionFactory.
 | 
						spring.activemq.pool.enabled=false # Whether a PooledConnectionFactory should be created, instead of a regular ConnectionFactory.
 | 
				
			||||||
	spring.activemq.pool.expiry-timeout=0ms # Connection expiration timeout.
 | 
					 | 
				
			||||||
	spring.activemq.pool.idle-timeout=30s # Connection idle timeout.
 | 
						spring.activemq.pool.idle-timeout=30s # Connection idle timeout.
 | 
				
			||||||
	spring.activemq.pool.max-connections=1 # Maximum number of pooled connections.
 | 
						spring.activemq.pool.max-connections=1 # Maximum number of pooled connections.
 | 
				
			||||||
	spring.activemq.pool.maximum-active-session-per-connection=500 # Maximum number of active sessions per connection.
 | 
						spring.activemq.pool.maximum-active-session-per-connection=500 # Maximum number of active sessions per connection.
 | 
				
			||||||
	spring.activemq.pool.reconnect-on-exception=true # Reset the connection when a "JMSException" occurs.
 | 
					 | 
				
			||||||
	spring.activemq.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.activemq.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.activemq.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.activemq.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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5119,6 +5119,8 @@ accordingly, as shown in the following example:
 | 
				
			||||||
	spring.activemq.pool.max-connections=50
 | 
						spring.activemq.pool.max-connections=50
 | 
				
			||||||
----
 | 
					----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WARNING: `PooledConnectionFactory` is not JMS 2.0 compliant
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TIP: See
 | 
					TIP: See
 | 
				
			||||||
{sc-spring-boot-autoconfigure}/jms/activemq/ActiveMQProperties.{sc-ext}[`ActiveMQProperties`]
 | 
					{sc-spring-boot-autoconfigure}/jms/activemq/ActiveMQProperties.{sc-ext}[`ActiveMQProperties`]
 | 
				
			||||||
for more of the supported options. You can also register an arbitrary number of beans
 | 
					for more of the supported options. You can also register an arbitrary number of beans
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue