/** * {@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); }
/** * {@inheritDoc} */ public Destination getDestination(EndpointInfo endpointInfo, Bus bus) throws IOException { JMSConfiguration jmsConf = JMSConfigFactory.createFromEndpointInfo(bus, endpointInfo, null); return new JMSDestination(bus, endpointInfo, jmsConf); }
@Override protected void doClose() throws IOException { this.sender.sendExchange(exchange, getBytes()); }
/** * @param messageProperties * @param inMessageProperties */ public static void initResponseMessageProperties(JMSMessageHeadersType messageProperties, JMSMessageHeadersType inMessageProperties) { messageProperties.setJMSDeliveryMode(inMessageProperties.getJMSDeliveryMode()); messageProperties.setJMSPriority(inMessageProperties.getJMSPriority()); messageProperties.setSOAPJMSRequestURI(inMessageProperties.getSOAPJMSRequestURI()); messageProperties.setSOAPJMSSOAPAction(inMessageProperties.getSOAPJMSSOAPAction()); messageProperties.setSOAPJMSBindingVersion("1.0"); }
private void updateJMSConfig(JMSConfiguration jmsConfig) { if (jmsConfig != null) { if(this.durableSubscriptionClientId!=null){ jmsConfig.setDurableSubscriptionClientId(durableSubscriptionClientId); } if(this.durableSubscriptionName!=null){ jmsConfig.setDurableSubscriptionName(durableSubscriptionName); jmsConfig.setSubscriptionDurable(true); } } }
public static JMSMessageHeadersType from(Message message) throws JMSException { JMSMessageHeadersType messageHeaders = new JMSMessageHeadersType(); messageHeaders.read(message); return messageHeaders; }
@Override public void initialize(Server server, Bus bus) { Destination destination = server.getDestination(); if (destination instanceof JMSDestination) { JMSDestination jmsDestination = (JMSDestination)destination; jmsDestination.getJmsConfig().setConnectionFactory(connectionFactory); } super.initialize(server, bus); } private class JMSConduitConfigOutInterceptor extends AbstractPhaseInterceptor<Message> {
public JMSDestination(Bus b, EndpointInfo info, JMSConfiguration jmsConfig) { super(b, getTargetReference(info, b), info); this.bus = b; this.jmsConfig = jmsConfig; info.setProperty(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, Boolean.TRUE); loader = bus.getExtension(ClassLoader.class); int restartLimit = jmsConfig.getMaxSuspendedContinuations() * jmsConfig.getReconnectPercentOfMax() / 100; this.suspendedContinuations = new ThrottlingCounter(restartLimit, jmsConfig.getMaxSuspendedContinuations()); }
@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 String getContentType() { String contentType = getSOAPJMSContentType(); if (contentType == null) { contentType = (String)getProperty(JMSSpecConstants.CONTENTTYPE_FIELD); } if (contentType == null) { contentType = (String)getProperty(JMSConstants.RS_CONTENT_TYPE); } if (contentType == null) { contentType = (String)getProperty(org.apache.cxf.message.Message.CONTENT_TYPE); } return contentType; }
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; }
public static org.apache.cxf.message.Message asCXFMessage(Message message, String jmsHeadersKey) throws UnsupportedEncodingException, JMSException { org.apache.cxf.message.Message inMessage = new MessageImpl(); JMSMessageHeadersType messageHeaders = JMSMessageHeadersType.from(message); inMessage.put(jmsHeadersKey, messageHeaders); populateIncomingContext(messageHeaders, inMessage); retrieveAndSetPayload(inMessage, message); return inMessage; }
@Override public void close() throws IOException { super.close(); sender.sendExchange(exchange, toString()); } }
/** * Prepare the message to be sent. The message will be sent after the caller has written the payload to * the OutputStream of the message and called the stream's close method. In the JMS case the * JMSOutputStream will then call back the sendExchange method of this class. {@inheritDoc} */ public void prepare(final Message message) throws IOException { boolean isTextPayload = JMSConstants.TEXT_MESSAGE_TYPE.equals(jmsConfig.getMessageType()); MessageStreamUtil.prepareStream(message, isTextPayload, this); }
@Override public void run() { restartConnection(); } }).start();
public Destination getReplyDestination(Session session) throws JMSException { if (this.replyDestinationDest == null) { synchronized (this) { if (this.replyDestinationDest == null) { this.replyDestinationDest = getReplyDestinationInternal(session); } } } return this.replyDestinationDest; }
@Override public void onException(JMSException exception) { jmsConfig.resetCachedReplyDestination(); staticReplyDestination = null; } });
private static void addJMSPropertiesFromMessage(JMSMessageHeadersType messageProperties, org.apache.cxf.message.Message message, String... keys) { for (String key : keys) { addJMSPropertyFromMessage(messageProperties, message, key); } }
public ConnectionFactory getConnectionFactory() { ConnectionFactory factory = connectionFactory; if (factory == null) { synchronized (this) { factory = connectionFactory; if (factory == null) { factory = getConnectionFactoryFromJndi(); connectionFactory = factory; } } } return factory; }