List of usage examples for javax.jms Session createSharedDurableConsumer
MessageConsumer createSharedDurableConsumer(Topic topic, String name, String messageSelector)
throws JMSException;
From source file:org.wso2.carbon.inbound.endpoint.protocol.jms.factory.JMSConnectionFactory.java
public MessageConsumer createMessageConsumer(Session session, Destination destination) { try {//from w ww.jav a 2 s .co m if (JMSConstants.JMS_SPEC_VERSION_2_0.equals(jmsSpec) && isSharedSubscription) { if (isDurable) { return session.createSharedDurableConsumer((Topic) destination, subscriptionName, messageSelector); } else { return session.createSharedConsumer((Topic) destination, subscriptionName, messageSelector); } } else if ((JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) || (JMSConstants.JMS_SPEC_VERSION_2_0.equals(jmsSpec) && !isSharedSubscription)) { if (isDurable) { return session.createDurableSubscriber((Topic) destination, subscriptionName, messageSelector, noPubSubLocal); } else { return session.createConsumer(destination, messageSelector); } } else { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { return ((QueueSession) session).createReceiver((Queue) destination, messageSelector); } else { if (isDurable) { return ((TopicSession) session).createDurableSubscriber((Topic) destination, subscriptionName, messageSelector, noPubSubLocal); } else { return ((TopicSession) session).createSubscriber((Topic) destination, messageSelector, false); } } } } catch (JMSException e) { logger.error("JMS Exception while creating consumer. " + e.getMessage(), e); } return null; }