use of org.apache.activemq.jms.pool.PooledConnectionFactory in project kylo by Teradata.
the class ActivemqPoolableConnectionProvider method activemqPoolableConnection.
/**
* @param activemqBrokerUrl - Activemq Broker Connection String
* @return pooled connection
*/
public PooledConnectionFactory activemqPoolableConnection(String activemqBrokerUrl) {
/**
* Initialise Activemq Factory for Connection
*/
ActiveMQConnectionFactory factory = initializeActiveMqFactoryConnection(activemqBrokerUrl);
/**
* Create Connection Pool using PooledConnectionFactory and add connectionFactory to it.
*/
PooledConnectionFactory poolConnection = new PooledConnectionFactory();
poolConnection.setConnectionFactory(factory);
/**
* Return connection from Pool
*/
return poolConnection;
}
use of org.apache.activemq.jms.pool.PooledConnectionFactory in project tesb-rt-se by Talend.
the class ImporterTest method createJmsComponent.
private JmsComponent createJmsComponent() {
JmsComponent jmsComponent = new JmsComponent();
PooledConnectionFactory pooled = createConnectionFactory();
jmsComponent.setConnectionFactory(pooled);
return jmsComponent;
}
use of org.apache.activemq.jms.pool.PooledConnectionFactory in project elephant by yanghuijava.
the class ActivemqConfig method singleConnectionFactory.
@Bean
@ConditionalOnProperty(prefix = "elephant.mq", value = "activemq-broker-url")
public SingleConnectionFactory singleConnectionFactory() {
ActiveMQConnectionFactory targetConnectionFactory = new ActiveMQConnectionFactory(this.mqProperties.getActivemqBrokerUrl());
if (!StringUtils.isEmpty(this.mqProperties.getActivemqUserName()) && !StringUtils.isEmpty(this.mqProperties.getActivemqPassword())) {
targetConnectionFactory.setUserName(this.mqProperties.getActivemqUserName());
targetConnectionFactory.setPassword(this.mqProperties.getActivemqPassword());
} else {
targetConnectionFactory.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
targetConnectionFactory.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);
}
PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory();
pooledConnectionFactory.setConnectionFactory(targetConnectionFactory);
pooledConnectionFactory.setMaxConnections(this.mqProperties.getActivemqPoolMaxConnections());
SingleConnectionFactory singleConnectionFactory = new SingleConnectionFactory();
singleConnectionFactory.setTargetConnectionFactory(pooledConnectionFactory);
return singleConnectionFactory;
}
use of org.apache.activemq.jms.pool.PooledConnectionFactory in project elephant by yanghuijava.
the class ActivemqConfig method singleConnectionFactory.
@Bean
public SingleConnectionFactory singleConnectionFactory(RedeliveryPolicy redeliveryPolicy) {
ActiveMQConnectionFactory targetConnectionFactory = new ActiveMQConnectionFactory(this.mqProperties.getActivemqBrokerUrl());
if (!StringUtils.isEmpty(this.mqProperties.getActivemqUserName()) && !StringUtils.isEmpty(this.mqProperties.getActivemqPassword())) {
targetConnectionFactory.setUserName(this.mqProperties.getActivemqUserName());
targetConnectionFactory.setPassword(this.mqProperties.getActivemqPassword());
} else {
targetConnectionFactory.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
targetConnectionFactory.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);
}
targetConnectionFactory.setRedeliveryPolicy(redeliveryPolicy);
PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory();
pooledConnectionFactory.setConnectionFactory(targetConnectionFactory);
pooledConnectionFactory.setMaxConnections(this.mqProperties.getActivemqPoolMaxConnections());
SingleConnectionFactory singleConnectionFactory = new SingleConnectionFactory();
singleConnectionFactory.setTargetConnectionFactory(pooledConnectionFactory);
return singleConnectionFactory;
}
use of org.apache.activemq.jms.pool.PooledConnectionFactory in project tesb-rt-se by Talend.
the class ImporterTest method createConnectionFactory.
private PooledConnectionFactory createConnectionFactory() {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("localhost:61616");
RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
redeliveryPolicy.setMaximumRedeliveries(2);
connectionFactory.setRedeliveryPolicy(redeliveryPolicy);
PooledConnectionFactory pooled = new PooledConnectionFactory();
pooled.setConnectionFactory(connectionFactory);
return pooled;
}
Aggregations