carrot.backends.pyamqplib
amqplib backend for carrot.
-
class carrot.backends.pyamqplib.Backend(connection, **kwargs)
amqplib backend
-
connection
A carrot.connection.AMQPConnection instance. An established
connection to the AMQP server.
-
ack(delivery_tag)
- Acknowledge a message by delivery tag.
-
cancel(consumer_tag)
- Cancel a channel by consumer tag.
-
close()
- Close the channel if open.
-
consume(limit=None)
- Returns an iterator that waits for one message at a time,
calling the callback when messages arrive.
-
declare_consumer(queue, no_ack, callback, consumer_tag, nowait=False)
- Declare a consumer.
-
exchange_declare(exchange, type, durable, auto_delete)
- Declare an named exchange.
-
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. |
-
message_to_python(raw_message)
- Convert encoded message body back to a Python value.
-
prepare_message(message_data, delivery_mode, priority=None, content_type=None, content_encoding=None)
- Encapsulate data into a AMQP message.
-
publish(message, exchange, routing_key, mandatory=None, immediate=None)
- Publish a message to a named exchange.
-
queue_bind(queue, exchange, routing_key)
- Bind queue to an exchange using a routing key.
-
queue_declare(queue, durable, exclusive, auto_delete, warn_if_exists=False)
- Declare a named queue.
-
queue_exists(queue)
Check if a queue has been declared.
-
queue_purge(queue, **kwargs)
- Discard all messages in the queue. This will delete the messages
and results in an empty queue.
-
reject(delivery_tag)
- Reject a message by deliver tag.
-
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.
-
body
- The message body. This data is serialized,
so you probably want to deserialize it using
carrot.backends.base.BaseMessage.decode().
-
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.
-
channel
- The AMQP channel. A amqplib.client_0_8.channel.Channel
instance.
-
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.