public static DelayedRetry ( System.TimeSpan timeSpan ) : |
||
timeSpan | System.TimeSpan | Delivery delay. |
리턴 |
/// <summary> /// Invokes the default recovery policy. /// </summary> /// <param name="config">The recoverability configuration.</param> /// <param name="errorContext">The error context.</param> /// <returns>The recoverability action.</returns> public static RecoverabilityAction Invoke(RecoverabilityConfig config, ErrorContext errorContext) { if (errorContext.Exception is MessageDeserializationException) { return(RecoverabilityAction.MoveToError(config.Failed.ErrorQueue)); } if (errorContext.ImmediateProcessingFailures <= config.Immediate.MaxNumberOfRetries) { return(RecoverabilityAction.ImmediateRetry()); } TimeSpan delay; if (TryGetDelay(errorContext.Message, errorContext.DelayedDeliveriesPerformed, config.Delayed, out delay)) { return(RecoverabilityAction.DelayedRetry(delay)); } return(RecoverabilityAction.MoveToError(config.Failed.ErrorQueue)); }
/// <summary> /// Invokes the default recovery policy. /// </summary> /// <param name="config">The recoverability configuration.</param> /// <param name="errorContext">The error context.</param> /// <returns>The recoverability action.</returns> public static RecoverabilityAction Invoke(RecoverabilityConfig config, ErrorContext errorContext) { Guard.AgainstNull(nameof(errorContext), errorContext); Guard.AgainstNull(nameof(config), config); foreach (var unrecoverableExceptionType in config.Failed.UnrecoverableExceptionTypes) { if (unrecoverableExceptionType.IsInstanceOfType(errorContext.Exception)) { return(RecoverabilityAction.MoveToError(config.Failed.ErrorQueue)); } } if (errorContext.ImmediateProcessingFailures <= config.Immediate.MaxNumberOfRetries) { return(RecoverabilityAction.ImmediateRetry()); } if (TryGetDelay(errorContext.Message, errorContext.DelayedDeliveriesPerformed, config.Delayed, out var delay)) { return(RecoverabilityAction.DelayedRetry(delay)); } return(RecoverabilityAction.MoveToError(config.Failed.ErrorQueue)); }