Peek-locked message counter in a Service Bus queue

Russell 21 Reputation points
2022-12-05T22:36:53.273+00:00

I need to monitor the number of peek-locked (delivered but not settled) messages in a Service Bus queue.

I don't see this state in the standard counters.

Is it available? If not, can it be queried programmatically?

Thanks!

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
0 comments No comments
{count} votes

Answer accepted by question author
  1. MayankBargali-MSFT 70,996 Reputation points Moderator
    2022-12-06T16:27:14.973+00:00

    @Russell Thanks for reaching out. Unfortunately, there are no property that can help you with the number of peek locked but the complete call was not made on a particular message.
    As this is the message level property (DeliveryCount) so the delivery count will only be available at the message level when you try to read the message and not at the queue level.
    When the message is failed to consume by your application then the DeliveryCount of individual message increase by one.

    If you need the count at the queue level then you need to have your custom logic for the calculation, but I will not suggest to peek all the message just to get the DeliveryCount of the individual messages and adding them to get the current count for the queue as this would be expensive operation peeking all the messages.

    Let me know if you have any queries or concerns.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.