public async ValueTask <Message> ReceiveAsync(CancellationToken cancellationToken = default)
        {
            while (true)
            {
                CheckState();

                try
                {
                    return(await _consumer.ReceiveAsync(cancellationToken).ConfigureAwait(false));
                }
                catch (ConsumerClosedException exception) when(IsRecoverable(exception))
                {
                    CheckState();

                    Log.RetryingReceiveAsync(_logger);

                    Suspend();
                    RecoveryRequested?.Invoke();
                    await _manualResetEvent.WaitAsync(cancellationToken).ConfigureAwait(false);
                }
            }
        }
Пример #2
0
 protected void HandleProducerClosed()
 {
     Suspend();
     RecoveryRequested?.Invoke();
 }