/** * Initialize jmsTemplate and jmsListener from jms configuration data in jmsConfig {@inheritDoc} */ public void activate() { getLogger().log(Level.FINE, "JMSDestination activate().... "); jmsConfig.ensureProperlyConfigured(); try { this.jmsListener = createTargetDestinationListener(); } catch (Exception e) { if (e.getCause() != null && InvalidClientIDException.class.isInstance(e.getCause())) { throw e; } if (!jmsConfig.isOneSessionPerConnection()) { // If first connect fails we will try to establish the connection in the background new Thread(new Runnable() { @Override public void run() { restartConnection(); } }).start(); } } }
private MessageConsumer createConsumer(final Connection connection, final Session session) throws JMSException { final MessageConsumer consumer; if (jmsConfig != null && jmsConfig.isOneSessionPerConnection()) { Destination destination; if (!isReply()) { destination = jmsConfig.getTargetDestination(session); } else { destination = jmsConfig.getReplyDestination(session); } consumer = createConsumer(destination, session); connection.start(); } else { consumer = createConsumer(session); } return consumer; }
/** * @param inMessage the incoming message * @return the inbuilt backchannel */ protected Conduit getInbuiltBackChannel(Message inMessage) { //with JMS, non-robust OneWays will never need to send back a response, even a "202" response. boolean robust = MessageUtils.getContextualBoolean(inMessage, Message.ROBUST_ONEWAY); if (inMessage.getExchange().isOneWay() && !robust) { return null; } if (jmsConfig.isOneSessionPerConnection()) { return new BackChannelConduit(inMessage, jmsConfig); } else { return new BackChannelConduit(inMessage, jmsConfig, connection); } }
closer.register(createInitialContext()); Connection connection; if (jmsConfig != null && jmsConfig.isOneSessionPerConnection()) { connection = closer.register(createConnection()); } else {
Connection c; if (jmsConfig.isOneSessionPerConnection()) { c = closer.register(JMSFactory.createConnection(jmsConfig)); c.start(); if (!jmsConfig.isOneSessionPerConnection()) { if (exchange.get(JMSUtil.JMS_MESSAGE_CONSUMER) != null) { ResourceCloser.close(exchange.get(JMSUtil.JMS_MESSAGE_CONSUMER));
if (!jmsConfig.isOneSessionPerConnection()) { connection = JMSFactory.createConnection(jmsConfig); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); suspendedContinuations.setListenerContainer(container); if (!jmsConfig.isOneSessionPerConnection()) { connection.start();
if (jmsConfig.isOneSessionPerConnection()) { container = new PollingMessageListenerContainer(jmsConfig, true, this); } else {