public ServiceBusReceiveTransport(IServiceBusHost host, ReceiveSettings settings, params TopicSubscriptionSettings[] subscriptionSettings)
        {
            _host                 = host;
            _settings             = settings;
            _subscriptionSettings = subscriptionSettings;
            _receiveObservers     = new ReceiveObservable();
            _endpointObservers    = new ReceiveEndpointObservable();

            _connectionRetryPolicy = Retry.Exponential(1000, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(1));
        }
        public RedisSagaRepositoryOptions(ConcurrencyMode concurrencyMode, TimeSpan?lockTimeout, string lockSuffix, string keyPrefix)
        {
            ConcurrencyMode = concurrencyMode;

            LockTimeout = lockTimeout ?? TimeSpan.FromSeconds(30);

            LockSuffix = string.IsNullOrEmpty(lockSuffix) ? "_lock" : lockSuffix;

            KeyPrefix = string.IsNullOrWhiteSpace(keyPrefix) ? null : keyPrefix.EndsWith(":") ? keyPrefix : $"{keyPrefix}:";

            RetryPolicy = Retry.Exponential(10, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(10), TimeSpan.FromMilliseconds(918));
        }
        private Action <IServiceBusReceiveEndpointConfigurator> GetReceiveEndpointConfigurator(Type messageType, Type consumerType)
        {
            return(c =>
            {
                c.EnableDeadLetteringOnMessageExpiration = true;
                c.SupportOrdering = true;
                c.SubscribeMessageTopics = false;
                c.MaxDeliveryCount = 3;
                c.EnableDeadLetteringOnMessageExpiration = true;
                c.UseRetry(Retry.Exponential(3, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(1)));

                if (IsTransactional(consumerType))
                {
                    c.UseTransaction(x =>
                    {
                        x.IsolationLevel = IsolationLevel.ReadCommitted;
                        x.Timeout = TimeSpan.FromMinutes(10);
                    });
                }

                c.Consumer(consumerType, t => container.GetInstance(t));
            });
        }
 private void DoRetry(Action action) =>
 Retry.Exponential(retryCount, retryDelay, action, Is <IOException>).ForEach(x => throw x);
 private A DoRetry <A>(Func <A> action) =>
 Retry.Exponential(retryCount, retryDelay, action, Is <IOException>).OrElseThrow();