am using azure service bus messaging, in that i'm getting some strange issue.
i created a subscription client with "peeklock" mode. using SubscriptionClient.ReceiveBatch(500) method and received 'n' messages. then loop those messages and do my process, if my process is successfully completed then use BrokeredMessage.Complete() to remove that message from queue. if there is any issue in that process am using BrokeredMessage.Abandon() to renew the message. But the messages are not removed from queue.
after some analysis, i suspect my process taking more time and the message locks are getting expired before the the process complete.
Then i decided, after received the message from queue, i pushed those messages into local string array and then called BrokeredMessage.Complete(). So there is no possibility for lock expiration. But still messages are not removed from queue.
Kindly give some idea to fix this issue.
But still messages are not removed from queue.
All of messages are not removed or part of messages are not removed? If it is possible, please share the reproduced demo code. - Tom Sun - MSFTvar client = GetQueueClient(false, QueueName); do { messages = await client.PeekBatchAsync(10); messages.Select(async x => await x.CompleteAsync()); } while (messages.Any()); await client.CloseAsync();'
When I debug this the Queue is empty, but when I write a Test that calls this code and checks if there are any messages they are all back again. - Nullawait _esb.ClearQueue(); var msgs = await _esb.RecieveObjectsAsync(); Assert.IsTrue(!msgs.Any()); // this passes msgs = await _esb.PeekObjectsAsync(); Assert.IsTrue(!msgs.Any());
// boom they are back again... Does it have to do with the client beeing different? - Null