I am using the PeekBatch(<messageCount>)
method on the QueueClient
(Windows Azure Service Bus package version 2.1.2.0).
It works fine the first time, and returns my single message that exists in my queue, but subsequent calls return nothing. After five minutes, the call will then return the message again.
Five minutes is the maximum lock time on a BrokeredMessage
, so I am wondering if PeekBatch
is actually locking those messages like it does on a receive, even though peeking should not lock, as far as I know.
I am trying to build an MVC view to be able to see what is actually sitting in my queue, but this one is getting in the way. Can anyone provide any guidance on this?
Update: This only seems to be happening when I cache my QueueClient
using a static property. If I create the QueueClient
fresh every time, the PeekBatch
works as expected. I still have no idea why reusing a QueueClient
causes this. Microsoft seems to recommend reusing the QueueClient
though, instead of recreating it every time, so I am still at a loss here.