Table of Contents

Class AsyncEventingBasicConsumer

Namespace
RabbitMQ.Client.Events
Assembly
RabbitMQ.Client.dll
public class AsyncEventingBasicConsumer : AsyncDefaultBasicConsumer, IAsyncBasicConsumer
Inheritance
AsyncEventingBasicConsumer
Implements
Inherited Members

Constructors

AsyncEventingBasicConsumer(IChannel)

Constructor which sets the Channel property to the given value.

public AsyncEventingBasicConsumer(IChannel channel)

Parameters

channel IChannel

Methods

HandleBasicConsumeOkAsync(string, CancellationToken)

Fires when the server confirms successful consumer registration.

public override Task HandleBasicConsumeOkAsync(string consumerTag, CancellationToken cancellationToken = default)

Parameters

consumerTag string
cancellationToken CancellationToken

Returns

Task

HandleBasicDeliverAsync(string, ulong, bool, string, string, IReadOnlyBasicProperties, ReadOnlyMemory<byte>, CancellationToken)

Fires the Received event.

public override 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)

Fires the Shutdown event.

public override Task HandleChannelShutdownAsync(object channel, ShutdownEventArgs reason)

Parameters

channel object
reason ShutdownEventArgs

Returns

Task

OnCancelAsync(string[], CancellationToken)

Fires when the server confirms successful consumer cancellation.

protected override Task OnCancelAsync(string[] consumerTags, CancellationToken cancellationToken = default)

Parameters

consumerTags string[]
cancellationToken CancellationToken

Returns

Task

Events

ReceivedAsync

Event fired when a delivery arrives for the consumer.

public event AsyncEventHandler<BasicDeliverEventArgs> ReceivedAsync

Event Type

AsyncEventHandler<BasicDeliverEventArgs>

Remarks

Handlers must copy or fully use delivery body before returning. Accessing the body at a later point is unsafe as its memory can be already released.

RegisteredAsync

Fires when the server confirms successful consumer registration.

public event AsyncEventHandler<ConsumerEventArgs> RegisteredAsync

Event Type

AsyncEventHandler<ConsumerEventArgs>

ShutdownAsync

Fires on channel shutdown, both client and server initiated.

public event AsyncEventHandler<ShutdownEventArgs> ShutdownAsync

Event Type

AsyncEventHandler<ShutdownEventArgs>

UnregisteredAsync

Fires when the server confirms successful consumer cancellation.

public event AsyncEventHandler<ConsumerEventArgs> UnregisteredAsync

Event Type

AsyncEventHandler<ConsumerEventArgs>