Beispiel #1
0
 public IMessageConsumer CreateConsumer(TopicType topicType, string strTopicName)
 {
     if (topicType.Equals(TopicType.Topic))
     {
         return(session.CreateConsumer(new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic(strTopicName)));
     }
     else
     {
         return(session.CreateConsumer(new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue(strTopicName)));
     }
 }
Beispiel #2
0
        public IMessageConsumer CreateConsumer(TopicType topicType, string strTopicName, string strSelector)
        {
            if (strSelector == "")
            {
                Console.WriteLine("MQ selector不能为空");
                return(null);
            }

            if (topicType.Equals(TopicType.Topic))
            {
                return(session.CreateConsumer(new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic(strTopicName), strSelector, false));
            }
            else
            {
                return(session.CreateConsumer(new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue(strTopicName), strSelector, false));
            }
        }