【发布时间】:2019-05-16 19:02:53
【问题描述】:
我对以下退避政策有疑问:
1 可以同时用于发布者(入队消息)和订阅者(出队消息)吗?
2 Rebus Backoff policy 和 Polly's Retry 一样吗?但是下面的描述提到了空闲时间,我有点困惑。
//
// Summary:
// Configures the timespans to wait when backing off polling the transport during
// idle times. backoffTimes must be a sequence of timespans, which indicates the
// time to wait for each second elapsed being idle. When the idle time exceeds the
// number of timespans, the last timespan will be used.
public static void SetBackoffTimes(this OptionsConfigurer configurer, params TimeSpan[] backoffTimes);
Configure.With(...)
.(...)
.Options(o => {
o.SetBackoffTimes(
TimeSpan.FromMilliseconds(100),
TimeSpan.FromMilliseconds(200),
TimeSpan.FromSeconds(1)
);
})
.Start();
3 Rebus 是否支持 Polly 扩展?例如,指数回退加上底部的一些抖动
Random jitterer = new Random();
Policy
.Handle<HttpResponseException>() // etc
.WaitAndRetry(5, // exponential back-off plus some jitter
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
+ TimeSpan.FromMilliseconds(jitterer.Next(0, 100))
);
4 我在最新的 Rebus nutget 上找不到ISyncBackoffStrategy。是否已弃用?
Configure.With(...)
.(...)
.Options(o => {
o.Register<ISyncBackoffStrategy>(c => {
var strategy = new MyOwnBackoffStrategy();
return strategy;
});
})
.Start();
【问题讨论】:
标签: rebus rebus-azureservicebus