use of javax.jms.Destination in project cxf by apache.
the class JAXRSJmsTest method testAddGetBook.
@Test
public void testAddGetBook() throws Exception {
Context ctx = getContext();
ConnectionFactory factory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
Destination destination = (Destination) ctx.lookup("dynamicQueues/test.jmstransport.text");
Destination replyToDestination = (Destination) ctx.lookup("dynamicQueues/test.jmstransport.response");
Connection connection = null;
try {
connection = factory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
postBook(session, destination, replyToDestination);
checkBookInResponse(session, replyToDestination, 124L, "JMS");
session.close();
} finally {
close(connection);
}
}
use of javax.jms.Destination in project cxf by apache.
the class SOAPJMSTestSuiteTest method twoWayTestWithCreateMessage.
public void twoWayTestWithCreateMessage(final TestCaseType testcase) throws Exception {
String address = testcase.getAddress();
EndpointInfo endpointInfo = new EndpointInfo();
endpointInfo.setAddress(JMSTestUtil.getFullAddress(address, broker.getBrokerURL()));
JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(staticBus, endpointInfo, null);
ResourceCloser closer = new ResourceCloser();
try {
Connection connection = closer.register(JMSFactory.createConnection(jmsConfig));
connection.start();
Session session = closer.register(connection.createSession(false, Session.AUTO_ACKNOWLEDGE));
Destination targetDest = jmsConfig.getTargetDestination(session);
Destination replyToDestination = jmsConfig.getReplyToDestination(session, null);
JMSSender sender = JMSFactory.createJmsSender(jmsConfig, null);
Message jmsMessage = JMSTestUtil.buildJMSMessageFromTestCase(testcase, session, replyToDestination);
sender.sendMessage(session, targetDest, jmsMessage);
Message replyMessage = JMSUtil.receive(session, replyToDestination, jmsMessage.getJMSMessageID(), 10000, true);
checkReplyMessage(replyMessage, testcase);
} catch (JMSException e) {
throw JMSUtil.convertJmsException(e);
} finally {
closer.close();
}
}
use of javax.jms.Destination in project vcell by virtualcell.
the class VCMessagingServiceActiveMQ method createConsumer.
@Override
public MessageConsumer createConsumer(Session jmsSession, VCDestination vcDestination, VCMessageSelector vcSelector, int prefetchLimit) throws JMSException {
Destination jmsDestination;
MessageConsumer jmsMessageConsumer;
if (vcDestination instanceof VCellQueue) {
jmsDestination = jmsSession.createQueue(vcDestination.getName() + "?consumer.prefetchSize=" + prefetchLimit);
} else {
jmsDestination = jmsSession.createTopic(vcDestination.getName() + "?consumer.prefetchSize=" + prefetchLimit);
}
if (vcSelector == null) {
jmsMessageConsumer = jmsSession.createConsumer(jmsDestination);
} else {
jmsMessageConsumer = jmsSession.createConsumer(jmsDestination, vcSelector.getSelectionString());
}
return jmsMessageConsumer;
}
use of javax.jms.Destination in project vcell by virtualcell.
the class QueueWatcher method start.
public void start() throws JMSException {
ActiveMQTopic[] tpcs = AdvisorySupport.getAllDestinationAdvisoryTopics(queue);
for (ActiveMQTopic tp : tpcs) {
writer.println("watching " + tp.getTopicName());
Destination ds = session.createTopic(tp.getPhysicalName());
MessageConsumer c = session.createConsumer(ds);
c.setMessageListener(new AdvListener(tp.getTopicName()));
}
}
use of javax.jms.Destination in project vcell by virtualcell.
the class VCMessagingServiceEmbedded method createConsumer.
@Override
public MessageConsumer createConsumer(Session jmsSession, VCDestination vcDestination, VCMessageSelector vcSelector, int prefetchLimit) throws JMSException, VCMessagingException {
if (!initialized) {
initialized = true;
init();
}
Destination jmsDestination;
MessageConsumer jmsMessageConsumer;
if (vcDestination instanceof VCellQueue) {
jmsDestination = jmsSession.createQueue(vcDestination.getName() + "?consumer.prefetchSize=" + prefetchLimit);
} else {
jmsDestination = jmsSession.createTopic(vcDestination.getName() + "?consumer.prefetchSize=" + prefetchLimit);
}
if (vcSelector == null) {
jmsMessageConsumer = jmsSession.createConsumer(jmsDestination);
} else {
jmsMessageConsumer = jmsSession.createConsumer(jmsDestination, vcSelector.getSelectionString());
}
return jmsMessageConsumer;
}
Aggregations