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

有帮助吗?

解决方案

  • 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.

Here is documentation on the PeakLock and ReceiveAndDelete values for ReceiveMode. Note that PeakLock is the default.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top