Apache.NMS.ActiveMQ.MessageConsumer.Shutdown C# (CSharp) Method

Shutdown() private method

Called from the parent Session of this Consumer to indicate that its parent session is closing and this Consumer should close down but not send any message to the Broker as the parent close will take care of removing its child resources at the broker.
private Shutdown ( ) : void
return void
        internal void Shutdown()
        {
            if(!this.unconsumedMessages.Closed)
            {
                if(Tracer.IsDebugEnabled)
                {
                    Tracer.DebugFormat("Shutdown of Consumer[{0}] started.", ConsumerId);
                }

                // Do we have any acks we need to send out before closing?
                // Ack any delivered messages now.
                if(!this.session.IsTransacted)
                {
                    DeliverAcks();
                    if(this.IsAutoAcknowledgeBatch)
                    {
                        Acknowledge();
                    }
                }

                if(!this.session.IsTransacted)
                {
                    lock(this.dispatchedMessages)
                    {
                        dispatchedMessages.Clear();
                    }
                }

                this.session.RemoveConsumer(this.ConsumerId);
                this.unconsumedMessages.Close();

                if(Tracer.IsDebugEnabled)
                {
                    Tracer.DebugFormat("Shutdown of Consumer[{0}] completed.", ConsumerId);
                }
            }
        }