Search code examples
c#azureservicebusdead-letter

Does one have to complete a message after dead-lettering it in Azure Service Bus?


When we use an Azure Service Bus queue in PeekLock mode, an error occurs and we call ServiceBusReceiver.DeadLetterMessageAsync explicitly, do we then also have to call ServiceBusReceiver.CompleteMessageAsync afterwards in order to settle the message? Or is the message already settled automatically by dead-lettering it?


Solution

  • The message will be placed in the dead letter queue just by calling DeadLetterMessageAsync on it. If you later want to remove the message from the dead letter queue then you need to actually lock it and call CompleteMessageAsync on it (if using Peek Lock mode).