Dispatch() public method

public Dispatch ( MessageDispatch dispatch ) : void
dispatch Apache.NMS.ActiveMQ.Commands.MessageDispatch
return void
Exemplo n.º 1
0
        public void Dispatch(MessageDispatch dispatch)
        {
            try
            {
                MessageConsumer consumer = null;

                lock (this.consumers.SyncRoot)
                {
                    if (this.consumers.Contains(dispatch.ConsumerId))
                    {
                        consumer = this.consumers[dispatch.ConsumerId] as MessageConsumer;
                    }
                }

                // If the consumer is not available, just ignore the message.
                // Otherwise, dispatch the message to the consumer.
                if (consumer != null)
                {
                    consumer.Dispatch(dispatch);
                }
            }
            catch (Exception ex)
            {
                Tracer.DebugFormat("Caught Exception While Dispatching: {0}", ex.Message);
            }
        }
Exemplo n.º 2
0
        public bool DispatchMessage(ConsumerId consumerId, Message message)
        {
            bool            dispatched = false;
            MessageConsumer consumer   = (MessageConsumer)consumers[consumerId];

            if (consumer != null)
            {
                consumer.Dispatch((ActiveMQMessage)message);
                dispatched = true;
            }

            return(dispatched);
        }