addDispatcher() 개인적인 메소드

private addDispatcher ( ConsumerId id, IDispatcher dispatcher ) : void
id Apache.NMS.ActiveMQ.Commands.ConsumerId
dispatcher IDispatcher
리턴 void
예제 #1
0
        public void AddConsumer(MessageConsumer consumer)
        {
            ConsumerId id = consumer.ConsumerId;

            // Registered with Connection before we register at the broker.
            consumers[id] = consumer;
            connection.addDispatcher(id, this);
        }
예제 #2
0
        public IMessageConsumer CreateConsumer(IDestination destination, string selector, bool noLocal)
        {
            if (destination == null)
            {
                throw new InvalidDestinationException("Cannot create a Consumer with a Null destination");
            }

            ConsumerInfo command = CreateConsumerInfo(destination, selector);

            command.NoLocal = noLocal;
            ConsumerId      consumerId = command.ConsumerId;
            MessageConsumer consumer   = null;

            // Registered with Connection before we register at the broker.
            connection.addDispatcher(consumerId, this);

            try
            {
                consumer = new MessageConsumer(this, command);
                // lets register the consumer first in case we start dispatching messages immediately
                consumers[consumerId] = consumer;
                this.Connection.SyncRequest(command);

                if (this.Started)
                {
                    consumer.Start();
                }

                return(consumer);
            }
            catch (Exception)
            {
                if (consumer != null)
                {
                    consumer.Close();
                }

                throw;
            }
        }