Пример #1
0
        internal static void ValidateRetryPolicyOptions(this DefaultRetryPolicyOptions retryPolicyOptions)
        {
            if (retryPolicyOptions == null)
            {
                throw new ArgumentNullException(nameof(retryPolicyOptions), $"Parameter {nameof(retryPolicyOptions)} is not specified.");
            }

            if (retryPolicyOptions.DeltaBackoff <= TimeSpan.Zero)
            {
                throw new ArgumentException($"Parameter {nameof(retryPolicyOptions.DeltaBackoff)} must be a positive timespan.");
            }

            if (retryPolicyOptions.MaxCumulativeWaitTime <= TimeSpan.Zero)
            {
                throw new ArgumentException($"Parameter {nameof(retryPolicyOptions.MaxCumulativeWaitTime)} must be a positive timespan.");
            }
        }
Пример #2
0
        IOptionalDeliveryConfiguration IOptionalDeliveryConfiguration.WithDefaultRetryPolicyOptions(DefaultRetryPolicyOptions retryPolicyOptions)
        {
            retryPolicyOptions.ValidateRetryPolicyOptions();
            _deliveryOptions.DefaultRetryPolicyOptions = retryPolicyOptions;

            return(this);
        }