public void DisposeMessage(ReceiveContext receiveContext, DispositionContext dispositionContext)
        {
            if (dispositionContext.DeliveryState is Rejected)
            {
                this.deadletterMessage.Add(receiveContext.Message);
            }
            else if (dispositionContext.DeliveryState is Released)
            {
                lock (this.messages)
                {
                    this.messages.Enqueue(receiveContext.Message);
                }
            }

            dispositionContext.Complete();
        }
        public Task<ReceiveContext> GetMessageAsync(ListenerLink link)
        {
            lock (this.messages)
            {
                ReceiveContext context = null;
                if (this.messages.Count > 0)
                {
                    context = new ReceiveContext(link, this.messages.Dequeue());
                }

                return Task.FromResult(context);
            }
        }
        public Task<ReceiveContext> GetMessageAsync(ListenerLink link)
        {
            lock (this.messages)
            {
                ReceiveContext context = null;
                if (this.messages.Count > 0)
                {
                    context = new ReceiveContext(link, this.messages.Dequeue());
                }

                var tcs = new TaskCompletionSource<ReceiveContext>();
                tcs.SetResult(context);
                return tcs.Task;
            }
        }