carrot.backends.pyamqplib

amqplib backend for carrot.

class carrot.backends.pyamqplib.Backend(connection, **kwargs)

amqplib backend

Parameter:connection – see connection.
connection

A carrot.connection.BrokerConnection instance. An established connection to the broker.

class Message(backend, amqp_message, **kwargs)

A message received by the broker.

Usually you don’t insantiate message objects yourself, but receive them using a carrot.messaging.Consumer.

Parameters:
body
The message body.
delivery_tag
The message delivery tag, uniquely identifying this message.
backend
The message backend used. A subclass of carrot.backends.base.BaseBackend.
_amqp_message
A amqplib.client_0_8.basic_message.Message instance. This is a private attribute and should not be accessed by production code.
Backend.ack(delivery_tag)
Acknowledge a message by delivery tag.
Backend.cancel(consumer_tag)
Cancel a channel by consumer tag.
Backend.channel
If no channel exists, a new one is requested.
Backend.close()
Close the channel if open.
Backend.close_connection(connection)
Close the AMQP broker connection.
Backend.consume(limit=None)
Returns an iterator that waits for one message at a time.
Backend.declare_consumer(queue, no_ack, callback, consumer_tag, nowait=False)
Declare a consumer.
Backend.establish_connection()
Establish connection to the AMQP broker.
Backend.exchange_declare(exchange, type, durable, auto_delete)
Declare an named exchange.
Backend.flow(active)
Enable/disable flow from peer.
Backend.get(queue, no_ack=False)

Receive a message from a declared queue by name.

Returns:A Message object if a message was received, None otherwise. If None was returned, it probably means there was no messages waiting on the queue.
Backend.message_to_python(raw_message)
Convert encoded message body back to a Python value.
Backend.prepare_message(message_data, delivery_mode, priority=None, content_type=None, content_encoding=None)
Encapsulate data into a AMQP message.
Backend.publish(message, exchange, routing_key, mandatory=None, immediate=None)
Publish a message to a named exchange.
Backend.qos(prefetch_size, prefetch_count, apply_global=False)
Request specific Quality of Service.
Backend.queue_bind(queue, exchange, routing_key)
Bind queue to an exchange using a routing key.
Backend.queue_declare(queue, durable, exclusive, auto_delete, warn_if_exists=False)
Declare a named queue.
Backend.queue_exists(queue)

Check if a queue has been declared.

Rtype bool:
Backend.queue_purge(queue, **kwargs)
Discard all messages in the queue. This will delete the messages and results in an empty queue.
Backend.reject(delivery_tag)
Reject a message by deliver tag.
Backend.requeue(delivery_tag)
Reject and requeue a message by delivery tag.
class carrot.backends.pyamqplib.Message(backend, amqp_message, **kwargs)

A message received by the broker.

Usually you don’t insantiate message objects yourself, but receive them using a carrot.messaging.Consumer.

Parameters:
body
The message body.
delivery_tag
The message delivery tag, uniquely identifying this message.
backend
The message backend used. A subclass of carrot.backends.base.BaseBackend.
_amqp_message
A amqplib.client_0_8.basic_message.Message instance. This is a private attribute and should not be accessed by production code.
exception carrot.backends.pyamqplib.QueueAlreadyExistsWarning
A queue with that name already exists, so a recently changed routing_key or other settings might be ignored unless you rename the queue or restart the broker.

Previous topic

carrot.backends.base

Next topic

carrot.backends.pystomp

This Page