You can use the ReceiveBatch method for Microsoft.ServiceBus.Messaging:
private MessageReceiver messageReceiver; var brokeredMessagesList = messageReceiver.ReceiveBatch(100);
You can put the lock in the queue until the processing of the received batch is completed, and after processing is complete, you can call CompleteBatch to release the lock in the queue:
List<Guid> messageLockTokenList = new List<System.Guid>(); foreach(BrokeredMessage message in brokeredMessagesList) { messageLockTokenList.Add(message.LockToken); } messageReceiver.CompleteBatch(messageLockTokenList)
source share