A library book reservation system uses an Azure Service Bus queue to manage user reservation requests. The reservation system must process each request reliably. If a worker instance fails or restarts while processing a request, the request message must not be lost and must become available again in the queue so that another worker can pick it up.
Which option or method should you configure for the Service Bus receiver to satisfy this requirement?
- ServiceBusReceiveMode.PeekLockCevap
- BServiceBusReceiveMode.ReceiveAndDelete
- CServiceBusReceiver.PeekMessagesAsync
- DServiceBusReceiver.DeferMessageAsync
Cevap
ServiceBusReceiveMode.PeekLock
The correct option is ServiceBusReceiveMode.PeekLock because it locks the message when retrieved, allowing the receiver to complete the processing. If the processing fails or the client crashes, the lock expires and the message is returned to the queue, ensuring no messages are lost.
Adım Adım Çözüm
Anahtar Kavram
Azure Service Bus Receive Modes