Search in sources :

Example 1 with MessageListenerContainer

use of org.apache.cxf.transport.jms.util.MessageListenerContainer in project cxf by apache.

the class JMSConduit method setupReplyDestination.

private void setupReplyDestination(Session session) throws JMSException {
    if (staticReplyDestination == null) {
        synchronized (this) {
            if (staticReplyDestination == null) {
                staticReplyDestination = jmsConfig.getReplyDestination(session);
                String messageSelector = JMSFactory.getMessageSelector(jmsConfig, conduitId);
                if (jmsConfig.getMessageSelector() != null) {
                    messageSelector += (messageSelector != null && !messageSelector.isEmpty() ? " AND " : "") + jmsConfig.getMessageSelector();
                }
                if (messageSelector == null && !jmsConfig.isPubSubDomain()) {
                    // An option for this might be a good idea for people who do not plan to share queues.
                    return;
                }
                AbstractMessageListenerContainer container;
                if (jmsConfig.isOneSessionPerConnection()) {
                    container = new PollingMessageListenerContainer(jmsConfig, true, this);
                } else {
                    container = new MessageListenerContainer(getConnection(), staticReplyDestination, this);
                }
                container.setTransactionManager(jmsConfig.getTransactionManager());
                container.setTransacted(jmsConfig.isSessionTransacted());
                container.setDurableSubscriptionName(jmsConfig.getDurableSubscriptionName());
                container.setMessageSelector(messageSelector);
                Object executor = bus.getProperty(JMSFactory.JMS_CONDUIT_EXECUTOR);
                if (executor instanceof Executor) {
                    container.setExecutor((Executor) executor);
                }
                container.start();
                jmsListener = container;
                addBusListener();
            }
        }
    }
}
Also used : Executor(java.util.concurrent.Executor) PollingMessageListenerContainer(org.apache.cxf.transport.jms.util.PollingMessageListenerContainer) MessageListenerContainer(org.apache.cxf.transport.jms.util.MessageListenerContainer) PollingMessageListenerContainer(org.apache.cxf.transport.jms.util.PollingMessageListenerContainer) AbstractMessageListenerContainer(org.apache.cxf.transport.jms.util.AbstractMessageListenerContainer) AbstractMessageListenerContainer(org.apache.cxf.transport.jms.util.AbstractMessageListenerContainer)

Aggregations

Executor (java.util.concurrent.Executor)1 AbstractMessageListenerContainer (org.apache.cxf.transport.jms.util.AbstractMessageListenerContainer)1 MessageListenerContainer (org.apache.cxf.transport.jms.util.MessageListenerContainer)1 PollingMessageListenerContainer (org.apache.cxf.transport.jms.util.PollingMessageListenerContainer)1