public interface IBasicConsumer

Known direct subtypes: DefaultBasicConsumer

Summary

Consumer interface. Used to receive messages from a queue by subscription.

Remarks

See IModel.BasicConsume, IModel.BasicCancel.

Note that the "Handle*" methods run in the connection's thread! Consider using QueueingBasicConsumer, which uses a SharedQueue instance to safely pass received messages across to user threads.

Property Summary

Type Name Summary
IModel Model (r)

Retrieve the this consumer is associated with, for use in acknowledging received messages, for instance.

Event Summary

Type Name Summary
EventHandler<ConsumerEventArgs> ConsumerCancelled

Signalled when the consumer gets cancelled.

Method Summary

Name Summary
void HandleBasicCancel(string consumerTag)

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 for notification of consumer cancellation due to basicCancel

void HandleBasicCancelOk(string consumerTag)

Called upon successful deregistration of the consumer from the broker.

void HandleBasicConsumeOk(string consumerTag)

Called upon successful registration of the consumer with the broker.

void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, byte[] body)

Called each time a message arrives for this consumer.

void HandleModelShutdown(object model, ShutdownEventArgs reason)

Called when the model shuts down.

Property Detail

IModel Model (r)

Summary

Retrieve the this consumer is associated with, for use in acknowledging received messages, for instance.

Event Detail

EventHandler<ConsumerEventArgs> ConsumerCancelled

Summary

Signalled when the consumer gets cancelled.

Method Detail

HandleBasicCancel

void HandleBasicCancel(string consumerTag)

Return type void
Parameters
Name Type
consumerTag string

Summary

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 for notification of consumer cancellation due to basicCancel

Param

Consumer tag this consumer is registered.

HandleBasicCancelOk

void HandleBasicCancelOk(string consumerTag)

Return type void
Parameters
Name Type
consumerTag string

Summary

Called upon successful deregistration of the consumer from the broker.

Param

Consumer tag this consumer is registered.

HandleBasicConsumeOk

void HandleBasicConsumeOk(string consumerTag)

Return type void
Parameters
Name Type
consumerTag string

Summary

Called upon successful registration of the consumer with the broker.

Param

Consumer tag this consumer is registered.

HandleBasicDeliver

void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, byte[] body)

Return type void
Parameters
Name Type
consumerTag string
deliveryTag ulong
redelivered bool
exchange string
routingKey string
properties IBasicProperties
body byte[]

Summary

Called each time a message arrives for this consumer.

Remarks

Does nothing with the passed in information. Note that in particular, some delivered messages may require acknowledgement via . The implementation of this method in this class does NOT acknowledge such messages.

HandleModelShutdown

void HandleModelShutdown(object model, ShutdownEventArgs reason)

Return type void
Parameters
Name Type
model object
reason ShutdownEventArgs

Summary

Called when the model shuts down.

Param

Common AMQP model.

Param

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