use of org.apache.activemq.pool.PooledConnectionFactory in project jim-framework by jiangmin168168.
the class ConnectionFactoryContainer method getPooledConnectionFactory.
public static PooledConnectionFactory getPooledConnectionFactory(String brokerUrl) {
final String brokerClusterUrl = brokerUrl.replace(";", ",");
PooledConnectionFactory connectionFactory = null;
// ((ActiveMQConnectionFactory)connectionFactory.getConnectionFactory()).get;
synchronized (lock) {
if (producerConnectionFactoryMap.containsKey(brokerClusterUrl)) {
connectionFactory = producerConnectionFactoryMap.get(brokerClusterUrl);
} else {
ProducerConnctionFactory producerConnctionFactory = new ProducerConnctionFactory();
// producerConnctionFactory.init();
connectionFactory = producerConnctionFactory.create(brokerClusterUrl);
producerConnectionFactoryMap.put(brokerClusterUrl, connectionFactory);
}
return connectionFactory;
}
}
use of org.apache.activemq.pool.PooledConnectionFactory in project jim-framework by jiangmin168168.
the class ConnectionFactoryContainer method getConsumerConnectionFactory.
public static PooledConnectionFactory getConsumerConnectionFactory(String brokerUrl) {
PooledConnectionFactory connectionFactory = null;
synchronized (lock) {
if (consumerConnectionFactoryMap.containsKey(brokerUrl)) {
connectionFactory = (PooledConnectionFactory) consumerConnectionFactoryMap.get(brokerUrl);
} else {
ConsumerConnctionFactory consumerConnctionFactory = new ConsumerConnctionFactory();
// producerConnctionFactory.init();
connectionFactory = consumerConnctionFactory.create(brokerUrl);
consumerConnectionFactoryMap.put(brokerUrl, connectionFactory);
}
return connectionFactory;
}
}
use of org.apache.activemq.pool.PooledConnectionFactory in project jim-framework by jiangmin168168.
the class ConnectionFactoryContainer method producerConnectionFactoryRebalance.
public static void producerConnectionFactoryRebalance() {
for (Map.Entry<String, PooledConnectionFactory> entry : producerConnectionFactoryMap.entrySet()) {
PooledConnectionFactory pooledConnectionFactory = entry.getValue();
if (null != pooledConnectionFactory) {
pooledConnectionFactory.setExpiryTimeout(30 * 1 * 1000);
System.out.println("expirytimeount set to 60*2*1000");
}
}
}
use of org.apache.activemq.pool.PooledConnectionFactory in project jim-framework by jiangmin168168.
the class ConsumerConnctionFactory method create.
public PooledConnectionFactory create(String brokerClusterUrl) {
ActiveMQConnectionFactory mqConnectionFactory = new ActiveMQConnectionFactory();
mqConnectionFactory.setBrokerURL(brokerClusterUrl);
mqConnectionFactory.setTransportListener(this);
// mqConnectionFactory.
PooledConnectionFactory connectionFactory = new JimPooledConnectionFactory(mqConnectionFactory);
connectionFactory.setMaxConnections(1);
connectionFactory.setCreateConnectionOnStartup(true);
return connectionFactory;
}
Aggregations