Azure Service Bus: Best way to implement exponential retry policy for failed to process messages

There is not a way to set an exponential back-off in the Service Bus configuration. I've experienced the same issue, and have done the following:

  1. Dequeue the message, and marked the message as received.
  2. Perform processing within a try/catch block. If there is an exception, enqueue a new message with a scheduled delivery at a certain point in the future.

We've wrapped our Service Bus Message Queue payload in a class that specifies the number of delivery attempts. We multiply the number of delivery attempts times a constant, then add that number to the current dateTime for scheduled delivery in the future. After the number of delivery attempts that we want to try are exceeded, we explicitly dead letter the message.

Edit 7-17-2020 Consider using Azure Durable Task Framework which has a customizable retry policy built right in.