Пример #1
0
        public async Task MarkFailed(OutgoingMessageBatch batch)
        {
            // If it's already latched, just enqueue again
            if (_sender.Latched)
            {
                await EnqueueForRetry(batch);

                return;
            }

            _failureCount++;

            if (_failureCount >= Endpoint.FailuresBeforeCircuitBreaks)
            {
                await _sender.LatchAndDrain();
                await EnqueueForRetry(batch);

                _circuitWatcher = new CircuitWatcher(this, _settings.Cancellation);
                //_circuitWatcher = new CircuitWatcher(_sender, _endpoint.PingIntervalForCircuitResume, restartSending);
            }
            else
            {
                foreach (var envelope in batch.Messages)
                {
#pragma warning disable 4014
                    _sender.Enqueue(envelope);
#pragma warning restore 4014
                }
            }
        }
Пример #2
0
        public Task MarkSuccess()
        {
            _failureCount = 0;
            _sender.Unlatch();
            _circuitWatcher = null;

            return(Task.CompletedTask);
        }
Пример #3
0
        Task ICircuit.Resume(CancellationToken cancellationToken)
        {
            _circuitWatcher = null;

            _sender.Unlatch();

            return(afterRestarting(_sender));
        }