use of org.apache.activemq.pool.PooledConnectionFactory in project camel by apache.
the class CamelJmsTestHelper method createPooledConnectionFactory.
public static PooledConnectionFactory createPooledConnectionFactory() {
ConnectionFactory cf = createConnectionFactory(null, null);
PooledConnectionFactory pooled = new PooledConnectionFactory();
pooled.setConnectionFactory(cf);
pooled.setMaxConnections(8);
return pooled;
}
use of org.apache.activemq.pool.PooledConnectionFactory in project ddf by codice.
the class OpenwireProducerConsumerExample method createCamelContext.
private void createCamelContext() throws Exception {
CamelContext camelContext = getContext();
ConnectionFactory jmsConnectFactory = createConnectionFactory();
PooledConnectionFactory jmsPooledConnectionFactory = new PooledConnectionFactory();
jmsPooledConnectionFactory.setConnectionFactory(jmsConnectFactory);
jmsPooledConnectionFactory.setMaxConnections(2);
JmsTransactionManager jmsTransactionManager = new JmsTransactionManager();
jmsTransactionManager.setConnectionFactory(jmsConnectFactory);
JmsConfiguration jmsConfiguration = new JmsConfiguration();
jmsConfiguration.setConnectionFactory(jmsPooledConnectionFactory);
jmsConfiguration.setTransacted(true);
jmsConfiguration.setTransactionManager(jmsTransactionManager);
jmsConfiguration.setCacheLevelName("CACHE_CONSUMER");
JmsComponent jms = new JmsComponent();
jms.setConfiguration(jmsConfiguration);
camelContext.addComponent("jms", jms);
}
use of org.apache.activemq.pool.PooledConnectionFactory in project cxf by apache.
the class MultiTransportClientServerTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
bus = BusFactory.getDefaultBus();
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
PooledConnectionFactory cfp = new PooledConnectionFactory(cf);
cff = new ConnectionFactoryFeature(cfp);
String address = "http://localhost:" + PORT + "/SOAPDocLitService/SoapPort";
Endpoint.publish(address, new HTTPGreeterImpl());
EndpointImpl ep1 = (EndpointImpl) Endpoint.create(new JMSGreeterImpl());
ep1.setBus(bus);
ep1.getFeatures().add(cff);
ep1.publish();
}
use of org.apache.activemq.pool.PooledConnectionFactory in project cxf by apache.
the class AbstractVmJMSTest method startBusAndJMS.
public static void startBusAndJMS(String brokerURI) {
bus = BusFactory.getDefaultBus();
ActiveMQConnectionFactory cf1 = new ActiveMQConnectionFactory(brokerURI);
RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
redeliveryPolicy.setMaximumRedeliveries(1);
redeliveryPolicy.setInitialRedeliveryDelay(1000);
cf1.setRedeliveryPolicy(redeliveryPolicy());
cf = new PooledConnectionFactory(cf1);
cff = new ConnectionFactoryFeature(cf);
}
use of org.apache.activemq.pool.PooledConnectionFactory in project jim-framework by jiangmin168168.
the class ProductController method test.
@RequestMapping("/test/{productId}")
public Long test(@PathVariable final long productId) {
productProducer.sendMessage(productId);
Map<String, PooledConnectionFactory> pooledConnectionFactoryMap = ConnectionFactoryContainer.getAllPooledConnectionFactory();
for (Map.Entry<String, PooledConnectionFactory> entry : pooledConnectionFactoryMap.entrySet()) {
JimPooledConnectionFactory jimPooledConnectionFactory = (JimPooledConnectionFactory) entry.getValue();
// jimPooledConnectionFactory.setExpiryTimeout();
GenericKeyedObjectPool<ConnectionKey, ConnectionPool> jimConnectionsPool = ((JimPooledConnectionFactory) entry.getValue()).getJimConnectionsPool();
// jimConnectionsPool.
jimConnectionsPool.clearOldest();
// jimConnectionsPool.set
Map<String, List<DefaultPooledObjectInfo>> defStringListMap = jimConnectionsPool.listAllObjects();
for (Map.Entry<String, List<DefaultPooledObjectInfo>> entry1 : defStringListMap.entrySet()) {
List<DefaultPooledObjectInfo> defaultPooledObjectInfos = entry1.getValue();
System.out.println("123");
for (DefaultPooledObjectInfo defaultPooledObjectInfo : defaultPooledObjectInfos) {
// defaultPooledObjectInfo.
System.out.println("123");
// ((ConnectionPool)defaultPooledObjectInfo.pooledObject.getObject()).connection;
}
}
// jimConnectionsPool.get
System.out.println("123");
// ((ObjectDeque)((java.util.concurrent.ConcurrentHashMap.MapEntry)((java.util.concurrent.ConcurrentHashMap)jimConnectionsPool.poolMap).entrySet().toArray()[0]).getValue()).allObjects
}
return productId;
}
Aggregations