C# Класс 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.
Наследование: IBasicConsumer
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
m_consumerCancelled EventHandler
m_eventLock object

Открытые методы

Метод Описание
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.

Описание методов

DefaultBasicConsumer() публичный Метод

Creates a new instance of an DefaultBasicConsumer.
public DefaultBasicConsumer ( ) : System
Результат System

DefaultBasicConsumer() публичный Метод

Constructor which sets the Model property to the given value.
public DefaultBasicConsumer ( IModel model ) : System
model IModel Common AMQP model.
Результат System

HandleBasicCancel() публичный Метод

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.
Результат void

HandleBasicCancelOk() публичный Метод

Called upon successful deregistration of the consumer from the broker.
public HandleBasicCancelOk ( string consumerTag ) : void
consumerTag string Consumer tag this consumer is registered.
Результат void

HandleBasicConsumeOk() публичный Метод

Called upon successful registration of the consumer with the broker.
public HandleBasicConsumeOk ( string consumerTag ) : void
consumerTag string Consumer tag this consumer is registered.
Результат void

HandleBasicDeliver() публичный Метод

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
Результат void

HandleModelShutdown() публичный Метод

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.
Результат void

OnCancel() публичный Метод

Default implementation - overridable in subclasses.
This default implementation simply sets the IsRunning property to false, and takes no further action.
public OnCancel ( ) : void
Результат void

Описание свойств

m_consumerCancelled публичное свойство

public EventHandler m_consumerCancelled
Результат EventHandler

m_eventLock публичное свойство

public object m_eventLock
Результат object