0
votes

I am using multiple consumers in order to receive messages from a queue with ReceiveMode.PeekLock. When I lock a message with one consumer but do not Complete the receiving of the message in order to be deleted from the queue, the other consumers do not have access to it.

My question is, do the other consumers have access to the other messages while that message is locked and not yet deleted from the queue, or ar they blocked from trying to dequeue and receive any other message from that queue?

1

1 Answers

2
votes

Yes, consumers do have access to other messages on the queue, just not the one that's locked.
Otherwise scaling based on queue messages wouldn't help since other consumers would be waiting for the first message to be processed, after which the consumer everybody is waiting on would be able to pick up the next message...

From Peek-Lock Message (Non-Destructive Read)

This operation atomically retrieves and locks a message from a queue or subscription for processing. The message is guaranteed not to be delivered to other receivers (on the same queue or subscription only) during the lock duration specified in the queue/subscription description. When the lock expires, the message becomes available to other receivers. In order to complete processing of the message, the receiver should issue a delete command with the lock ID received from this operation. To abandon processing of the message and unlock it for other receivers, an Unlock Message command should be issued, otherwise the lock duration period can expire.