|
|
@ -26,6 +26,7 @@ import org.apache.activemq.pool.PooledConnectionFactory;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
import org.springframework.boot.jta.XAConnectionFactoryWrapper;
|
|
|
|
import org.springframework.boot.jta.XAConnectionFactoryWrapper;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
@ -53,15 +54,25 @@ class ActiveMQXAConnectionFactoryConfiguration {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public ConnectionFactory nonXaJmsConnectionFactory(ActiveMQProperties properties) {
|
|
|
|
@ConditionalOnProperty(prefix = "spring.activemq", name = "pooled", havingValue = "false", matchIfMissing = true)
|
|
|
|
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactoryFactory(
|
|
|
|
public ActiveMQConnectionFactory nonXaJmsConnectionFactory(
|
|
|
|
properties).createConnectionFactory(ActiveMQConnectionFactory.class);
|
|
|
|
ActiveMQProperties properties) {
|
|
|
|
if (properties.isPooled()) {
|
|
|
|
return new ActiveMQConnectionFactoryFactory(properties)
|
|
|
|
PooledConnectionFactory pool = new PooledConnectionFactory();
|
|
|
|
.createConnectionFactory(ActiveMQConnectionFactory.class);
|
|
|
|
pool.setConnectionFactory(connectionFactory);
|
|
|
|
}
|
|
|
|
return pool;
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnClass(PooledConnectionFactory.class)
|
|
|
|
|
|
|
|
@ConditionalOnProperty(prefix = "spring.activemq", name = "pooled", havingValue = "true", matchIfMissing = false)
|
|
|
|
|
|
|
|
static class PooledConnectionFactoryConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean(destroyMethod = "stop")
|
|
|
|
|
|
|
|
public PooledConnectionFactory pooledNonXaJmsConnectionFactory(
|
|
|
|
|
|
|
|
ActiveMQProperties properties) {
|
|
|
|
|
|
|
|
return new PooledConnectionFactory(
|
|
|
|
|
|
|
|
new ActiveMQConnectionFactoryFactory(properties)
|
|
|
|
|
|
|
|
.createConnectionFactory(ActiveMQConnectionFactory.class));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return connectionFactory;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|