Example #1
0
        public void HandleBasicCancelOk(string consumerTag)
        {
            BasicConsumerRpcContinuation k =
                (BasicConsumerRpcContinuation)m_continuationQueue.Next();

            Trace.Assert(k.m_consumerTag == consumerTag, string.Format(
                             "Consumer tag mismatch during cancel: {0} != {1}",
                             k.m_consumerTag,
                             consumerTag
                             ));

            lock (m_consumers)
            {
                k.m_consumer = (IBasicConsumer)m_consumers[consumerTag];
                m_consumers.Remove(consumerTag);
            }
            try {
                k.m_consumer.HandleBasicCancelOk(consumerTag);
            } catch (Exception e) {
                // FIXME: should we propagate the exception to the
                // caller of BasicCancel?
                CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
                args.Detail["consumer"] = k.m_consumer;
                args.Detail["context"]  = "HandleBasicCancelOk";
                OnCallbackException(args);
            }
            k.HandleCommand(null); // release the continuation.
        }
Example #2
0
        public string BasicConsume(string queue,
                                   bool noAck,
                                   string consumerTag,
                                   bool noLocal,
                                   bool exclusive,
                                   IDictionary filter,
                                   IBasicConsumer consumer)
        {
            ModelShutdown += new ModelShutdownEventHandler(consumer.HandleModelShutdown);

            BasicConsumerRpcContinuation k = new BasicConsumerRpcContinuation();

            k.m_consumer = consumer;

            Enqueue(k);
            // Non-nowait. We have an unconventional means of getting
            // the RPC response, but a response is still expected.
            try
            {
                _Private_BasicConsume(queue, consumerTag, noLocal, noAck, exclusive,
                                      /*nowait:*/ false, filter);
            }
            catch (AlreadyClosedException)
            {
                // Ignored, since the continuation will be told about
                // the closure via an OperationInterruptedException because
                // of the shutdown event propagation.
            }
            k.GetReply();
            string actualConsumerTag = k.m_consumerTag;

            return(actualConsumerTag);
        }
        public void HandleBasicConsumeOk(string consumerTag)
        {
            BasicConsumerRpcContinuation k =
                (BasicConsumerRpcContinuation)m_continuationQueue.Next();

            k.m_consumerTag = consumerTag;
            lock (m_consumers)
            {
                m_consumers[consumerTag] = k.m_consumer;
            }
            try
            {
                k.m_consumer.HandleBasicConsumeOk(consumerTag);
            }
            catch (Exception e)
            {
                // FIXME: should we propagate the exception to the
                // caller of BasicConsume?
                CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
                args.Detail["consumer"] = k.m_consumer;
                args.Detail["context"]  = "HandleBasicConsumeOk";
                OnCallbackException(args);
            }
            k.HandleCommand(null); // release the continuation.
        }
Example #4
0
        public void BasicCancel(string consumerTag)
        {
            BasicConsumerRpcContinuation k = new BasicConsumerRpcContinuation();

            k.m_consumerTag = consumerTag;

            Enqueue(k);

            try
            {
                _Private_BasicCancel(consumerTag, false);
            }
            catch (AlreadyClosedException)
            {
                // Ignored, since the continuation will be told about
                // the closure via an OperationInterruptedException because
                // of the shutdown event propagation.
            }

            k.GetReply();

            ModelShutdown -= new ModelShutdownEventHandler(k.m_consumer.HandleModelShutdown);
        }
        public void BasicCancel(string consumerTag)
        {
            BasicConsumerRpcContinuation k = new BasicConsumerRpcContinuation();
            k.m_consumerTag = consumerTag;

            Enqueue(k);

            _Private_BasicCancel(consumerTag, false);
            k.GetReply();

            ModelShutdown -= new ModelShutdownEventHandler(k.m_consumer.HandleModelShutdown);
        }
        public string BasicConsume(string queue,
                                   bool noAck,
                                   string consumerTag,
                                   bool noLocal,
                                   bool exclusive,
                                   IDictionary<string, object> arguments,
                                   IBasicConsumer consumer)
        {
            ModelShutdown += new ModelShutdownEventHandler(consumer.HandleModelShutdown);

            BasicConsumerRpcContinuation k = new BasicConsumerRpcContinuation();
            k.m_consumer = consumer;

            Enqueue(k);
            // Non-nowait. We have an unconventional means of getting
            // the RPC response, but a response is still expected.
            _Private_BasicConsume(queue, consumerTag, noLocal, noAck, exclusive,
                                  /*nowait:*/ false, arguments);
            k.GetReply();
            string actualConsumerTag = k.m_consumerTag;

            return actualConsumerTag;
        }
        public string BasicConsume(string queue,
            bool autoAck,
            string consumerTag,
            bool noLocal,
            bool exclusive,
            IDictionary<string, object> arguments,
            IBasicConsumer consumer)
        {
            var k = new BasicConsumerRpcContinuation { m_consumer = consumer };

            Enqueue(k);
            // Non-nowait. We have an unconventional means of getting
            // the RPC response, but a response is still expected.
            _Private_BasicConsume(queue, consumerTag, noLocal, autoAck, exclusive,
                /*nowait:*/ false, arguments);
            k.GetReply(this.ContinuationTimeout);
            string actualConsumerTag = k.m_consumerTag;

            return actualConsumerTag;
        }
        public void BasicCancel(string consumerTag)
        {
            var k = new BasicConsumerRpcContinuation { m_consumerTag = consumerTag };

            Enqueue(k);

            _Private_BasicCancel(consumerTag, false);
            k.GetReply(this.ContinuationTimeout);
            lock (m_consumers)
            {
                m_consumers.Remove(consumerTag);
            }

            ModelShutdown -= k.m_consumer.HandleModelShutdown;
        }
        public string BasicConsume(string queue,
                                   bool noAck,
                                   string consumerTag,
                                   bool noLocal,
                                   bool exclusive,
                                   IDictionary<string, object> arguments,
                                   IBasicConsumer consumer)
        {
            ModelShutdown += new ModelShutdownEventHandler(consumer.HandleModelShutdown);

            BasicConsumerRpcContinuation k = new BasicConsumerRpcContinuation();
            k.m_consumer = consumer;

            Enqueue(k);
            // Non-nowait. We have an unconventional means of getting
            // the RPC response, but a response is still expected.
            try
            {
                _Private_BasicConsume(queue, consumerTag, noLocal, noAck, exclusive,
                    /*nowait:*/ false, arguments);
            }
            catch (AlreadyClosedException)
            {
                // Ignored, since the continuation will be told about
                // the closure via an OperationInterruptedException because
                // of the shutdown event propagation.
            }
            k.GetReply();
            string actualConsumerTag = k.m_consumerTag;

            return actualConsumerTag;
        }
        public void BasicCancel(string consumerTag)
        {
            BasicConsumerRpcContinuation k = new BasicConsumerRpcContinuation();
            k.m_consumerTag = consumerTag;

            Enqueue(k);

            try
            {
                _Private_BasicCancel(consumerTag, false);
            }
            catch (AlreadyClosedException)
            {
                // Ignored, since the continuation will be told about
                // the closure via an OperationInterruptedException because
                // of the shutdown event propagation.
            }

            k.GetReply();

            ModelShutdown -= new ModelShutdownEventHandler(k.m_consumer.HandleModelShutdown);
        }