Azure Service Bus · AZ-204: Developing Solutions for Microsoft Azure Connect to and Consume Azure and Third-party Services

A .NET application uses an Azure.Messaging.ServiceBus ServiceBusProcessor with AutoCompleteMessages set to false and the default PeekLock receive mod…

Practice question from Azure Service Bus (AZ-204: Developing Solutions for Microsoft Azure Connect to and Consume Azure and Third-party Services), with the correct answer and a step-by-step solution.

medium · MCQ · Q-18B85A

A .NET application uses an Azure.Messaging.ServiceBus ServiceBusProcessor with AutoCompleteMessages set to false and the default PeekLock receive mode. The handler successfully processes a message. Which action should the handler perform so that the message is removed from the queue?

  1. A.Call CompleteMessageAsync on the ServiceBusReceiver with the received messageCorrect answer
  2. B.Call AbandonMessageAsync on the ServiceBusReceiver with the received message
  3. C.Call DeferMessageAsync on the ServiceBusReceiver with the received message
  4. D.Call RenewMessageLockAsync on the ServiceBusReceiver with the received message

Solution

In PeekLock mode, the message remains in the queue until it is settled. With automatic completion disabled, the handler must call CompleteMessageAsync after successful processing. Abandoning makes it available for redelivery, deferring postpones retrieval, and renewing only extends the lock.

More from Azure Service Bus

All of Azure Service Bus

Practise more Connect to and Consume Azure and Third-party Services

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed