0 votes
in Azure by
What is the difference between Receive and Peek in the context of Azure Service Bus Topics?

1 Answer

0 votes
by

Peek: This method enables you to view messages without locking or receiving them.

Receive: Can work in 2 modes:

PeekLock (receives the message but keeps it peek-locked until the receiver abandons the message. The maximum timeout is 5 minutes before message expiration) and

ReceiveAndDelete (deletes the message after it is received).

So this means you'll use the Peek when your goal is to look at the messages without actually consuming them (maybe you're building a "Queue browser", ... or your process needs to decided if it wants/can consume the message). And you'll use Receive when you're really planning to consume the message and do whatever you need to do with it.

...