I have Azure Service Bus setup with a bunch of queues on it. Some are partitioned. When I tried to read dead letter messages from one of those queues I've deferred messages, then did some massaging and then try to complete those deferred messages. And this is where trouble came in. On the call to the QueueClient.ReceiveBatch()
I'm getting InavlidOperationException
exception with following message:
ReceiveBatch of sequence numbers from different partitions is not supported for an entity with partitioning enabled.
Inner exception contains following justification:
BR0012ReceiveBatch of sequence numbers from different partitions is not supported for an entity with partitioning enabled.
Here is actual line of code, which produces the error:
var deferredMessages = queueClient?.ReceiveBatch(lstSequenceNums);
where lstSequenceNums is type of List<long>
and contains sequence numbers of deferred messages; queueClient is of type QueueClient
So I wonder how should this situation be handled? I don't quite understand why that exception has been thrown in the first place? If that expected behavior how I could figure out relation between partition and Service Bus message sequence number?
Any help would be greatly appreciated.