Posts

Showing posts from July, 2017

Azure ServiceBus PeekBatch or ReceiveBatch don't reliably get all messages

I had a requirement with respect to Microsoft's Azure ServiceBus to "resubmit all the messages in the Dead Letter Queue back to the original topic."  Say the messages were dead lettered because of some transient failure and you just want to resubmit them.  So you would think you could just get a reference to the dead letter queue, loop through all the messages (or grab them asynchronously in a batch) and easily process them all. Turns out it's not so simple if your subscription is a partitioned queue.  You might have an impulse to use the "PeekBatch" or "ReceiveBatch" commands to say, grab all the messages, then process them, as in this stack overflow post  which describes how it does not reliably grab all the messages.  This is because (in our case) we were using a partitioned queue.  So the message might be in a different partition, which is why you're not getting all of them.  See the "Browse/Peek messages" section of this MS po...