Interface IAsyncBasicConsumer
Consumer interface. Used to receive messages from a queue by subscription.
public interface IAsyncBasicConsumer
Properties
Channel
Retrieve the IChannel this consumer is associated with, for use in acknowledging received messages, for instance.
IChannel? Channel { get; }
Property Value
Methods
HandleBasicCancelAsync(string, CancellationToken)
Called when the consumer is cancelled for reasons other than by a basicCancel: e.g. the queue has been deleted (either by this channel or by any other channel). See HandleBasicCancelOkAsync(string, CancellationToken) for notification of consumer cancellation due to basicCancel
Task HandleBasicCancelAsync(string consumerTag, CancellationToken cancellationToken = default)
Parameters
consumerTag
stringConsumer tag this consumer is registered.
cancellationToken
CancellationTokenThe cancellation token.
Returns
HandleBasicCancelOkAsync(string, CancellationToken)
Called upon successful deregistration of the consumer from the broker.
Task HandleBasicCancelOkAsync(string consumerTag, CancellationToken cancellationToken = default)
Parameters
consumerTag
stringConsumer tag this consumer is registered.
cancellationToken
CancellationTokenThe cancellation token.
Returns
HandleBasicConsumeOkAsync(string, CancellationToken)
Called upon successful registration of the consumer with the broker.
Task HandleBasicConsumeOkAsync(string consumerTag, CancellationToken cancellationToken = default)
Parameters
consumerTag
stringConsumer tag this consumer is registered.
cancellationToken
CancellationTokenThe cancellation token.
Returns
HandleBasicDeliverAsync(string, ulong, bool, string, string, IReadOnlyBasicProperties, ReadOnlyMemory<byte>, CancellationToken)
Called each time a message arrives for this consumer.
Does nothing with the passed in information.
Note that in particular, some delivered messages may require acknowledgement via BasicAckAsync(ulong, bool, CancellationToken).
The implementation of this method in this class does NOT acknowledge such messages.
NOTE: Using the body
outside of
HandleBasicDeliverAsync(string, ulong, bool, string, string, IReadOnlyBasicProperties, ReadOnlyMemory<byte>, CancellationToken)
requires that it be copied!
Task HandleBasicDeliverAsync(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IReadOnlyBasicProperties properties, ReadOnlyMemory<byte> body, CancellationToken cancellationToken = default)
Parameters
consumerTag
stringdeliveryTag
ulongredelivered
boolexchange
stringroutingKey
stringproperties
IReadOnlyBasicPropertiesbody
ReadOnlyMemory<byte>cancellationToken
CancellationToken
Returns
HandleChannelShutdownAsync(object, ShutdownEventArgs)
Called when the channel shuts down.
Task HandleChannelShutdownAsync(object channel, ShutdownEventArgs reason)
Parameters
channel
objectCommon AMQP channel.
reason
ShutdownEventArgsInformation about the reason why a particular channel, session, or connection was destroyed.