Interface IBasicConsumer
Consumer interface. Used to receive messages from a queue by subscription.
Namespace: RabbitMQ.Client
Assembly: Apigen.dll
Syntax
public interface IBasicConsumer
Remarks
See IModel.BasicConsume, IModel.BasicCancel.
Note that the "Handle*" methods run in the connection's thread! Consider using EventingBasicConsumer, which uses a SharedQueue instance to safely pass received messages across to user threads.
Properties
| Edit this page View SourceModel
Retrieve the IModel this consumer is associated with, for use in acknowledging received messages, for instance.
Declaration
IModel Model { get; }
Property Value
Type | Description |
---|---|
IModel |
Methods
| Edit this page View SourceHandleBasicCancel(string)
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 HandleBasicCancelOk(string) for notification of consumer cancellation due to basicCancel
Declaration
void HandleBasicCancel(string consumerTag)
Parameters
Type | Name | Description |
---|---|---|
string | consumerTag | Consumer tag this consumer is registered. |
HandleBasicCancelOk(string)
Called upon successful deregistration of the consumer from the broker.
Declaration
void HandleBasicCancelOk(string consumerTag)
Parameters
Type | Name | Description |
---|---|---|
string | consumerTag | Consumer tag this consumer is registered. |
HandleBasicConsumeOk(string)
Called upon successful registration of the consumer with the broker.
Declaration
void HandleBasicConsumeOk(string consumerTag)
Parameters
Type | Name | Description |
---|---|---|
string | consumerTag | Consumer tag this consumer is registered. |
HandleBasicDeliver(string, ulong, bool, string, string, IBasicProperties, ReadOnlyMemory<byte>)
Called each time a message arrives for this consumer.
Declaration
void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, ReadOnlyMemory<byte> body)
Parameters
Type | Name | Description |
---|---|---|
string | consumerTag | |
ulong | deliveryTag | |
bool | redelivered | |
string | exchange | |
string | routingKey | |
IBasicProperties | properties | |
ReadOnlyMemory<byte> | body |
Remarks
Does nothing with the passed in information. Note that in particular, some delivered messages may require acknowledgement via BasicAck(ulong, bool). The implementation of this method in this class does NOT acknowledge such messages.
HandleModelShutdown(object, ShutdownEventArgs)
Called when the model shuts down.
Declaration
void HandleModelShutdown(object model, ShutdownEventArgs reason)
Parameters
Type | Name | Description |
---|---|---|
object | model | Common AMQP model. |
ShutdownEventArgs | reason | Information about the reason why a particular model, session, or connection was destroyed. |
Events
| Edit this page View SourceConsumerCancelled
Signalled when the consumer gets cancelled.
Declaration
event EventHandler<ConsumerEventArgs> ConsumerCancelled
Event Type
Type | Description |
---|---|
EventHandler<ConsumerEventArgs> |