Esempio n. 1
0
        private void Configure()
        {
            this.BuildProducers();
            var builder = this.senderOptions.GetProducerSelectorBuilder();

            this.producerSelector = builder.Build(this.producers.ToList());
        }
Esempio n. 2
0
        public FaultTolerantProducer(IProducerSelector selector, int attempts)
        {
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            this.selector = selector;
            this.attempts = attempts;
        }
Esempio n. 3
0
        public FaultTolerantProducer(IProducerSelector selector, int maxAttempts, int maxRetryDelay, int inactivityResetDelay)
        {
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            this.selector = selector;
            this.attempts = maxAttempts;
        }
Esempio n. 4
0
        private void Configure()
        {
            this.BuildProducers();
            var builder = this.senderOptions.GetProducerSelectorBuilder();

            this.producerSelector = builder.Build(this.producers);

            var sendAttempts  = this.senderOptions.GetFailoverAttempts() ?? 1;
            var maxRetryDelay = this.senderOptions.GetMaxRetryDelay().GetValueOrDefault();
            var resetDelay    = this.senderOptions.GetInactivityResetDelay().GetValueOrDefault();

            this.faultTolerantProducer = new FaultTolerantProducer(this.producerSelector, sendAttempts, maxRetryDelay, resetDelay);
        }
Esempio n. 5
0
        public FaultTolerantProducer(IProducerSelector selector, int maxAttempts, int maxRetryDelay, int inactivityResetDelay)
        {
            if (selector == null)
            {
                throw new ArgumentNullException(nameof(selector));
            }

            this.logger = LogManager.GetLogger($"{this.GetType().FullName}({this.GetHashCode()})");

            this.selector             = selector;
            this.maxAttempts          = maxAttempts;
            this.maxRetryDelay        = maxRetryDelay;
            this.inactivityResetDelay = inactivityResetDelay;

            this.resetTimer = new Timer(this.OnTimer);

            this.logger.Trace(
                $"Initialized with max attempts = {this.maxAttempts}, max retry delay = {this.maxRetryDelay}, inactivity reset delay = {this.inactivityResetDelay}");
        }