Exemplo n.º 1
0
        public async Task EnqueueAbandonDequeue()
        {
            // create a test queue
            Queue testQueue = await this.CreateQueue();

            // send a test message
            TestQueueMessage sendMessage = await this.SendMessage(testQueue);

            // receive it
            TestQueueMessage recvMessage = (TestQueueMessage)await testQueue.ReceiveAsync();

            // compare it
            Assert.IsTrue(sendMessage.Equals(recvMessage));

            // abandon it
            await testQueue.AbandonAsync(recvMessage);

            // receive it again
            TestQueueMessage recvMessage2 = (TestQueueMessage)await testQueue.ReceiveAsync();

            // compare it
            Assert.IsTrue(sendMessage.Equals(recvMessage2));

            // delete message
            await testQueue.CompleteAsync(recvMessage2);

            // delete queue
            await this.sb.DeleteQueueAsync(this.queueName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Abandon message
        /// </summary>
        /// <param name="message">Queue message</param>
        /// <returns>Abandon message task</returns>
        public async Task AbandonMessage(IMessage message)
        {
            Queue queue = await this.queueManager.GetQueue(this.QueueIdentifier);

            await queue.AbandonAsync(message as QueueMessage);
        }