private Connection getConnection() throws JMSException { Connection result = connection; if (result == null) { synchronized (this) { result = connection; if (result == null) { result = JMSFactory.createConnection(jmsConfig); trySetExListener(result); result.start(); connection = result; } } } return result; }
connection = closer.register(JMSFactory.createConnection(jmsConfig)); } else { connection = this.persistentConnection; session, correlationId, JMS_SERVER_RESPONSE_HEADERS); JMSSender sender = JMSFactory.createJmsSender(jmsConfig, outProps); LOG.log(Level.FINE, "server sending reply: ", reply); sender.sendMessage(session, replyTo, reply);
private String sendMessage(final Object request, final Message outMessage, Destination replyToDestination, String correlationId, ResourceCloser closer, Session session) throws JMSException { JMSMessageHeadersType headers = getOrCreateJmsHeaders(outMessage); javax.jms.Message message = JMSMessageUtils.asJMSMessage(jmsConfig, outMessage, request, jmsConfig.getMessageType(), session, correlationId, JMSConstants.JMS_CLIENT_REQUEST_HEADERS); if (replyToDestination == null && headers.isSetJMSReplyTo()) { String replyTo = headers.getJMSReplyTo(); replyToDestination = jmsConfig.getReplyDestination(session, replyTo); } if (replyToDestination != null) { message.setJMSReplyTo(replyToDestination); } JMSSender sender = JMSFactory.createJmsSender(jmsConfig, headers); Destination targetDest = jmsConfig.getTargetDestination(session); sender.sendMessage(session, targetDest, message); String jmsMessageID = message.getJMSMessageID(); LOG.log(Level.FINE, "client sending request message " + jmsMessageID + " to " + targetDest); headers.setJMSMessageID(jmsMessageID); return jmsMessageID; }
staticReplyDestination = jmsConfig.getReplyDestination(session); String messageSelector = JMSFactory.getMessageSelector(jmsConfig, conduitId); if (jmsConfig.getMessageSelector() != null) { messageSelector += (messageSelector != null && !messageSelector.isEmpty() ? " AND " : "")
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(); } }
private Connection createConnection() { try { return JMSFactory.createConnection(jmsConfig); } catch (JMSException e) { handleException(e); throw JMSUtil.convertJmsException(e); } }
c = closer.register(JMSFactory.createConnection(jmsConfig)); c.start(); } else {
connection = JMSFactory.createConnection(jmsConfig); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = jmsConfig.getTargetDestination(session);