/** * {@inheritDoc} */ public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target, Bus bus) throws IOException { JMSConfiguration jmsConf = JMSConfigFactory.createFromEndpointInfo(bus, endpointInfo, target); return new JMSConduit(target, jmsConf, bus); }
@Override protected void finalize() throws Throwable { close(); super.finalize(); }
/** * When a message is received on the reply destination the correlation map is searched for the * correlationId. If it is found the message is converted to a CXF message and the thread sending the * request is notified {@inheritDoc} */ public void onMessage(javax.jms.Message jmsMessage) { try { String correlationId = jmsMessage.getJMSCorrelationID(); LOG.log(Level.FINE, "Received reply message with correlation id " + correlationId); Exchange exchange = getExchange(correlationId); if (exchange == null) { LOG.log(Level.WARNING, "Could not correlate message with correlationId " + correlationId); } else { processReplyMessage(exchange, jmsMessage); } } catch (JMSException e) { throw JMSUtil.convertJmsException(e); } }
Session session) throws JMSException { setupReplyDestination(session); JMSMessageHeadersType headers = getOrCreateJmsHeaders(outMessage); String userCID = headers.getJMSCorrelationID(); assertIsNotAsyncAndUserCID(exchange, userCID); String correlationId = createCorrelationId(exchange, userCID); if (correlationId != null) { correlationMap.put(correlationId, exchange); String jmsMessageID = sendMessage(request, outMessage, jmsConfig.getReplyToDestination(session, replyTo), correlationId, closer, session); jmsConfig.isPubSubNoLocal(), exchange); processReplyMessage(exchange, replyMessage); } else { try {
assertIsNotTextMessageAndMtom(outMessage); c.start(); } else { c = getConnection(); sendMessage(request, outMessage, null, null, closer, session); } else { sendAndReceiveMessage(exchange, request, outMessage, closer, session);
@Override public void initialize(Client client, Bus bus) { Conduit conduit = client.getConduit(); if (conduit instanceof JMSConduit) { JMSConfiguration jmsConfig = ((JMSConduit) conduit).getJmsConfig(); updateJMSConfig(jmsConfig); } }
container = new PollingMessageListenerContainer(jmsConfig, true, this); } else { container = new MessageListenerContainer(getConnection(), staticReplyDestination, this); addBusListener();
/** * Process the reply message * @throws JMSException */ protected void processReplyMessage(Exchange exchange, javax.jms.Message jmsMessage) throws JMSException { LOG.log(Level.FINE, "client received reply: ", jmsMessage); try { Message inMessage = JMSMessageUtils.asCXFMessage(jmsMessage, JMSConstants.JMS_CLIENT_RESPONSE_HEADERS); if (jmsConfig.isCreateSecurityContext()) { SecurityContext securityContext = SecurityContextFactory.buildSecurityContext(jmsMessage, jmsConfig); inMessage.put(SecurityContext.class, securityContext); } exchange.setInMessage(inMessage); Object responseCode = inMessage.get(org.apache.cxf.message.Message.RESPONSE_CODE); exchange.put(org.apache.cxf.message.Message.RESPONSE_CODE, responseCode); if (exchange.isSynchronous()) { synchronized (exchange) { exchange.put(CORRELATED, Boolean.TRUE); exchange.notifyAll(); } } if (incomingObserver != null) { incomingObserver.onMessage(exchange.getInMessage()); } } catch (UnsupportedEncodingException ex) { getLogger().log(Level.WARNING, "can't get the right encoding information " + ex); } }
@Override public void handleMessage(Message message) throws Fault { Conduit conduit = message.getExchange().getConduit(message); if (conduit instanceof JMSConduit) { JMSConduit jmsConduit = (JMSConduit)conduit; jmsConduit.getJmsConfig().setConnectionFactory(connectionFactory); } } }
public void preShutdown() { unreg(); blcm = null; JMSConduit c = ref.get(); if (c != null) { c.listener = null; c.close(); } } public void unreg() {