Пример #1
0
        public IMessageConsumer CreateConsumer(Queue queue, string selector = null)
        {
            if (this.queueConnection.IsStarted)
            {
                throw new QueueingException("Cannot create consumer on an already opened connection. Create new session instead.");
            }

            this.OpenConnection(this.queueConnection, queue);
            Apache.NMS.IDestination     destination = SessionUtil.GetDestination(this.queueSession, queue.Name);
            Apache.NMS.IMessageConsumer consumer    = this.queueSession.CreateConsumer(destination, selector);

            return(consumer);
        }
Пример #2
0
        public Apache.NMS.IMessageConsumer CreateConsumer(
            Apache.NMS.IDestination destination, string selector)
        {
            Apache.NMS.XMS.Destination destinationObj =
                (Apache.NMS.XMS.Destination)destination;

            try
            {
                Apache.NMS.IMessageConsumer consumer =
                    XMSConvert.ToNMSMessageConsumer(this,
                                                    this.xmsSession.CreateConsumer(
                                                        destinationObj.xmsDestination, selector));
                ConfigureConsumer(consumer);
                return(consumer);
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
                return(null);
            }
        }
Пример #3
0
        public Apache.NMS.IMessageConsumer CreateDurableConsumer(
            Apache.NMS.ITopic destination, string name, string selector,
            bool noLocal)
        {
            Apache.NMS.XMS.Topic topicObj = (Apache.NMS.XMS.Topic)destination;

            try
            {
                Apache.NMS.IMessageConsumer consumer =
                    XMSConvert.ToNMSMessageConsumer(this,
                                                    this.xmsSession.CreateDurableSubscriber(
                                                        topicObj.xmsDestination, name, selector, noLocal));
                ConfigureConsumer(consumer);
                return(consumer);
            }
            catch (Exception ex)
            {
                ExceptionUtil.WrapAndThrowNMSException(ex);
                return(null);
            }
        }
Пример #4
0
 private void ConfigureConsumer(Apache.NMS.IMessageConsumer consumer)
 {
     consumer.ConsumerTransformer = this.ConsumerTransformer;
 }