consumer

Provide the Consumer class to manage a consumer connection to RabbitMQ

class Consumer(rabbitmq_config)[source]

Bases: object

A consumer connects to some RabbitMQ instance and eats messages from it

Parameters:rabbitmq_config (pyloggr.config.RabbitMQBaseConfig) – RabbitMQ consumer configuration
_on_consumer_cancelled_by_server(method_frame=None)[source]

Invoked by pika when RabbitMQ sends a Basic.Cancel for a consumer.

_on_message(unused_channel, basic_deliver, properties, body)[source]

Invoked by pika when a message is delivered from RabbitMQ.

consuming

Returns true if the consumer is actually in consuming state

start()[source]

Opens the connection to RabbitMQ as a consumer

Returns:a Toro.Event object that triggers when the connection to RabbitMQ is lost

Note

Coroutine

start_consuming()[source]

Starts consuming messages from RabbitMQ

Returns:a Toro message queue that stores the messages when they arrive
Return type:SimpleToroQueue
stop()[source]

Shutdowns the connection to RabbitMQ and stops the consumer

Note

Tornado coroutine

stop_consuming()[source]

Stops consuming messages from RabbitMQ

Note

Tornado coroutine