List of usage examples for javax.jms Session createSharedConsumer
MessageConsumer createSharedConsumer(Topic topic, String sharedSubscriptionName,
java.lang.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 {/*ww w . j ava2 s . com*/ 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; }