public ResilientErrorHandlingStrategy(
            [NotNull] ILogFactory logFactory,
            [NotNull] RabbitMqSubscriptionSettings settings,
            TimeSpan retryTimeout,
            int retryNum = 5,
            IErrorHandlingStrategy next = null)
        {
            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }
            if (retryTimeout <= TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException(nameof(retryTimeout), retryTimeout, "Should be positive time span");
            }
            if (retryNum <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(retryNum), retryNum, "Should be positive number");
            }

            _log          = logFactory.CreateLog(this);
            _settings     = settings ?? throw new ArgumentNullException(nameof(settings));
            _retryTimeout = retryTimeout;
            _retryNum     = retryNum;
            _next         = next;
        }
示例#2
0
        public DeadQueueErrorHandlingStrategy(
            [NotNull] ILogFactory logFactory,
            [NotNull] RabbitMqSubscriptionSettings settings)
        {
            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }

            _log      = logFactory.CreateLog(this);
            _settings = settings ?? throw new ArgumentNullException(nameof(settings));
        }
        public ResilientErrorHandlingStrategy(ILog log, RabbitMqSubscriptionSettings settings, TimeSpan retryTimeout, int retryNum = 5, IErrorHandlingStrategy next = null)
        {
            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            _log          = log;
            _settings     = settings;
            _retryTimeout = retryTimeout;
            _retryNum     = retryNum;
            _next         = next;
        }
示例#4
0
 public DeadQueueErrorHandlingStrategy(ILog log, RabbitMqSubscriptionSettings settings)
 {
     _log      = log;
     _settings = settings;
 }
 public DefaultErrorHandlingStrategy(ILog log, RabbitMqSubscriptionSettings settings, IErrorHandlingStrategy next = null)
 {
     _log      = log ?? throw new ArgumentNullException(nameof(log));
     _settings = settings ?? throw new ArgumentNullException(nameof(settings));
     _next     = next;
 }
 internal static string GetPublisherName(this RabbitMqSubscriptionSettings settings)
 {
     return($"Publisher {settings.ExchangeName}");
 }
 internal static string GetQueueOrExchangeName(this RabbitMqSubscriptionSettings settings)
 {
     return($"Exchange: {settings.ExchangeName}{(!string.IsNullOrEmpty(settings.QueueName) ? $" Queue: {settings.QueueName}" : string.Empty)}");
 }
 internal static string GetSubscriberName(this RabbitMqSubscriptionSettings settings)
 {
     return($"Subscriber {settings.QueueName}{(!string.IsNullOrWhiteSpace(settings.RoutingKey) ? $"/{settings.RoutingKey}" : string.Empty)}");
 }