I am struggling with messages ending up in dead letter queue too quickly. I have specified an ExponentialRetry policy like this:
private readonly RetryExponential _retryPolicy = new RetryExponential(
TimeSpan.FromSeconds(1),
TimeSpan.FromMinutes(20),
10);
When SQL Server is temporarily down ("because its replica role is RESOLVING which does not allow connections. Try the operation again later.
") then the messages end up in dead letter queue without retries.
What do I do to get retries?
I looked in the source code for the SDK, and it seems that only transient ServiceBusException give retries, but I find that quite odd.
UPDATE:
After discussing with my coworkers and looking a little bit more in Application Insights, I can see that it actually has retried 10 times, but all within 2 seconds. This is the Max Delivery Count set on the subscription itself - not on the client. This delivery is not affected by any exponential backoff as I want and need.