public Task StopAsync(CancellationToken cancellationToken) { if (!_started) { return(Task.CompletedTask); } _rabbitMQModel.BasicCancel(_consumerTag); _rabbitMQModel.Close(); _started = false; _disposed = true; return(Task.CompletedTask); }
public Task StopAsync(CancellationToken cancellationToken) { ThrowIfDisposed(); if (!_started) { throw new InvalidOperationException("The listener has not yet been started or has already been stopped"); } _rabbitMQModel.BasicCancel(_consumerTag); _rabbitMQModel.Close(); _started = false; _disposed = true; return(Task.CompletedTask); }