use of org.apache.activemq.pool.PooledConnectionFactory in project cxf by apache.
the class ClientMtomXopWithJMSTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
Object implementor = new TestMtomJMSImpl();
bus = BusFactory.getDefaultBus();
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
PooledConnectionFactory cfp = new PooledConnectionFactory(cf);
cff = new ConnectionFactoryFeature(cfp);
EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
ep.getFeatures().add(cff);
ep.getInInterceptors().add(new TestMultipartMessageInterceptor());
ep.getOutInterceptors().add(new TestAttachmentOutInterceptor());
// ep.getInInterceptors().add(new LoggingInInterceptor());
// ep.getOutInterceptors().add(new LoggingOutInterceptor());
SOAPBinding jaxWsSoapBinding = (SOAPBinding) ep.getBinding();
jaxWsSoapBinding.setMTOMEnabled(true);
ep.publish();
}
use of org.apache.activemq.pool.PooledConnectionFactory in project cxf by apache.
the class MessageIdAsCorrelationIdJMSConduitTest method sendAndReceive.
public void sendAndReceive(boolean synchronous, String replyDestination) throws Exception {
BusFactory bf = BusFactory.newInstance();
Bus bus = bf.createBus();
BusFactory.setDefaultBus(bus);
EndpointReferenceType target = new EndpointReferenceType();
connectionFactory = new PooledConnectionFactory(BROKER_URI);
TestReceiver receiver = new TestReceiver(connectionFactory, SERVICE_QUEUE, true);
receiver.runAsync();
JMSConfiguration jmsConfig = new JMSConfiguration();
jmsConfig.setTargetDestination(SERVICE_QUEUE);
jmsConfig.setConnectionFactory(connectionFactory);
jmsConfig.setUseConduitIdSelector(false);
jmsConfig.setReplyDestination(replyDestination);
JMSConduit conduit = new JMSConduit(target, jmsConfig, bus);
Exchange exchange = new ExchangeImpl();
exchange.setSynchronous(synchronous);
Message message = new MessageImpl();
exchange.setOutMessage(message);
conduit.sendExchange(exchange, "Request");
waitForAsyncReply(exchange);
receiver.close();
if (exchange.getInMessage() == null) {
throw new RuntimeException("No reply received within 2 seconds");
}
JMSMessageHeadersType inHeaders = (JMSMessageHeadersType) exchange.getInMessage().get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
Assert.assertEquals(receiver.getRequestMessageId(), inHeaders.getJMSCorrelationID());
conduit.close();
bus.shutdown(true);
}
use of org.apache.activemq.pool.PooledConnectionFactory in project cxf by apache.
the class PooledConnectionTempQueueTest method testTempQueueIssue.
@Test
public void testTempQueueIssue() throws JMSException, InterruptedException {
final PooledConnectionFactory cf = new PooledConnectionFactory("vm://localhost?broker.persistent=false");
Connection con1 = cf.createConnection();
con1.start();
// This order seems to matter to reproduce the issue
con1.close();
Executors.newSingleThreadExecutor().execute(new Runnable() {
public void run() {
try {
receiveAndRespondWithMessageIdAsCorrelationId(cf, SERVICE_QUEUE);
} catch (JMSException e) {
e.printStackTrace();
}
}
});
sendWithReplyToTemp(cf, SERVICE_QUEUE);
}
use of org.apache.activemq.pool.PooledConnectionFactory in project jim-framework by jiangmin168168.
the class ActivemqConfiguration method init.
@PostConstruct
public void init() {
String brokerClusterString = ConnectionFactoryContainer.buildProducerBrokerClusterUri(Constans.PRODUCER_BROKER_URL);
PooledConnectionFactory pooledConnectionFactory = ConnectionFactoryContainer.getPooledConnectionFactory(brokerClusterString);
JmsTemplate jmsTemplate = new JmsTemplate(pooledConnectionFactory);
QueueJmsTemplateContainer.setQueJmsTemplateMap(Constans.QUEUE_NAME, jmsTemplate);
}
use of org.apache.activemq.pool.PooledConnectionFactory in project jim-framework by jiangmin168168.
the class ConnectionFactoryContainer method producerConnectionFactoryResetExpiryTimeout.
public static void producerConnectionFactoryResetExpiryTimeout() {
for (Map.Entry<String, PooledConnectionFactory> entry : producerConnectionFactoryMap.entrySet()) {
PooledConnectionFactory pooledConnectionFactory = entry.getValue();
if (null != pooledConnectionFactory) {
if (pooledConnectionFactory.getExpiryTimeout() != 0) {
pooledConnectionFactory.setExpiryTimeout(0);
System.out.println("expirytimeount set to 0");
}
}
}
}
Aggregations