Table of Contents

Interface IAsyncBasicConsumer

Namespace
RabbitMQ.Client
Assembly
RabbitMQ.Client.dll

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

IChannel

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 string

Consumer tag this consumer is registered.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

HandleBasicCancelOkAsync(string, CancellationToken)

Called upon successful deregistration of the consumer from the broker.

Task HandleBasicCancelOkAsync(string consumerTag, CancellationToken cancellationToken = default)

Parameters

consumerTag string

Consumer tag this consumer is registered.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

HandleBasicConsumeOkAsync(string, CancellationToken)

Called upon successful registration of the consumer with the broker.

Task HandleBasicConsumeOkAsync(string consumerTag, CancellationToken cancellationToken = default)

Parameters

consumerTag string

Consumer tag this consumer is registered.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

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 string
deliveryTag ulong
redelivered bool
exchange string
routingKey string
properties IReadOnlyBasicProperties
body ReadOnlyMemory<byte>
cancellationToken CancellationToken

Returns

Task

HandleChannelShutdownAsync(object, ShutdownEventArgs)

Called when the channel shuts down.

Task HandleChannelShutdownAsync(object channel, ShutdownEventArgs reason)

Parameters

channel object

Common AMQP channel.

reason ShutdownEventArgs

Information about the reason why a particular channel, session, or connection was destroyed.

Returns

Task