Beispiel #1
0
 public Policy Build()
 {
     _circuitBreakerPolicyAsync = _policyBuilder.CircuitBreakerAsync(_exceptionsAllowedBeforeBreaking,
                                                                     _durationOfBreak,
                                                                     (ex, breakDelay) =>
     {
         _log.Error("发生异常:", ex);
     },
                                                                     () =>
     {
         _log.Debug("正在重新启动任务");
     });
     _circuitBreakerPolicy = _policyBuilder.CircuitBreaker(_exceptionsAllowedBeforeBreaking,
                                                           _durationOfBreak,
                                                           (ex, breakDelay) =>
     {
         _log.Error("发生异常:", ex);
     },
                                                           () =>
     {
         _log.Debug("正在重新启动任务");
     });
     return(_circuitBreakerPolicyAsync);
 }
 public Policy CreatePolicy(PolicyBuilder policyBuilder) =>
 policyBuilder.CircuitBreaker(_exceptionsAllowedBeforeBreaking, _durationOfBreak);
 public Policy <TResult> CreatePolicy <TResult>(PolicyBuilder <TResult> policyBuilder) =>
 policyBuilder.CircuitBreaker(_exceptionsAllowedBeforeBreaking, _durationOfBreak);