本文介绍了实施ServiceBusTransientErrorDetectionStrategy指数重试政策的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现重试政策服务总线暂时性错误。我想我的系统尝试像指数1S,2S,4S,8S,16S,32S,64S,128S。

I am trying to implement Retry Policy for Service Bus transient error. I want my system to try exponentially like 1s, 2s, 4s, 8s, 16s, 32s, 64s, 128s.

    private int minBackoffDelayInMilliseconds = 2000;
    private int maxBackoffDelayInMilliseconds = 10000;
    private int deltaBackoffInMilliseconds = 2000;

    var defaultPolicy = new RetryPolicy<ServiceBusTransientErrorDetectionStrategy>(new ExponentialBackoff(maxRetries, TimeSpan.FromMilliseconds(minBackoffDelayInMilliseconds), TimeSpan.FromMilliseconds(maxBackoffDelayInMilliseconds), TimeSpan.FromMilliseconds(deltaBackoffInMilliseconds))

这是否正确?与此政策影响系统性能?

Does this look right ? and does this policy affect the system performance ?

推荐答案

下面是天蓝色CAT队一个很好的文章,显示了两个例子。

Here is a good article from the Azure CAT team that shows a couple of examples.

https://azure.microsoft.com/en-us/documentation/articles/best-practices-retry-service-specific/#service-bus-retry-guidelines

他们建议做这样的:

namespaceManager.Settings.RetryPolicy = new RetryExponential(TimeSpan.FromSeconds(0.1),TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), 3);

这篇关于实施ServiceBusTransientErrorDetectionStrategy指数重试政策的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 06:22