C# Class RabbitMQ.Client.DefaultBasicConsumer

Useful default/base implementation of IBasicConsumer. Subclass and override HandleBasicDeliver in application code.
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, or RabbitMQ.Client.MessagePatterns.Subscription, which manages resource declaration and binding in addition to providing a thread-safe interface.
Inheritance: IBasicConsumer
Afficher le fichier Open project: rabbitmq/rabbitmq-dotnet-client Class Usage Examples

Méthodes publiques

Свойство Type Description
m_consumerCancelled EventHandler
m_eventLock object

Méthodes publiques

Méthode Description
DefaultBasicConsumer ( ) : System

Creates a new instance of an DefaultBasicConsumer.

DefaultBasicConsumer ( IModel model ) : System

Constructor which sets the Model property to the given value.

HandleBasicCancel ( string consumerTag ) : void

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

HandleBasicCancelOk ( string consumerTag ) : void

Called upon successful deregistration of the consumer from the broker.

HandleBasicConsumeOk ( string consumerTag ) : void

Called upon successful registration of the consumer with the broker.

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

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 IModel.BasicAck. The implementation of this method in this class does NOT acknowledge such messages.

HandleModelShutdown ( object model, RabbitMQ.Client.ShutdownEventArgs reason ) : void

Called when the model shuts down.

OnCancel ( ) : void

Default implementation - overridable in subclasses.

This default implementation simply sets the IsRunning property to false, and takes no further action.

Method Details

DefaultBasicConsumer() public méthode

Creates a new instance of an DefaultBasicConsumer.
public DefaultBasicConsumer ( ) : System
Résultat System

DefaultBasicConsumer() public méthode

Constructor which sets the Model property to the given value.
public DefaultBasicConsumer ( IModel model ) : System
model IModel Common AMQP model.
Résultat System

HandleBasicCancel() public méthode

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 for notification of consumer cancellation due to basicCancel
public HandleBasicCancel ( string consumerTag ) : void
consumerTag string Consumer tag this consumer is registered.
Résultat void

HandleBasicCancelOk() public méthode

Called upon successful deregistration of the consumer from the broker.
public HandleBasicCancelOk ( string consumerTag ) : void
consumerTag string Consumer tag this consumer is registered.
Résultat void

HandleBasicConsumeOk() public méthode

Called upon successful registration of the consumer with the broker.
public HandleBasicConsumeOk ( string consumerTag ) : void
consumerTag string Consumer tag this consumer is registered.
Résultat void

HandleBasicDeliver() public méthode

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 IModel.BasicAck. The implementation of this method in this class does NOT acknowledge such messages.
public HandleBasicDeliver ( string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, byte body ) : void
consumerTag string
deliveryTag ulong
redelivered bool
exchange string
routingKey string
properties IBasicProperties
body byte
Résultat void

HandleModelShutdown() public méthode

Called when the model shuts down.
public HandleModelShutdown ( object model, RabbitMQ.Client.ShutdownEventArgs reason ) : void
model object Common AMQP model.
reason RabbitMQ.Client.ShutdownEventArgs Information about the reason why a particular model, session, or connection was destroyed.
Résultat void

OnCancel() public méthode

Default implementation - overridable in subclasses.
This default implementation simply sets the IsRunning property to false, and takes no further action.
public OnCancel ( ) : void
Résultat void

Property Details

m_consumerCancelled public_oe property

public EventHandler m_consumerCancelled
Résultat EventHandler

m_eventLock public_oe property

public object m_eventLock
Résultat object