carrot.backends.base¶
Backend base classes.
- class carrot.backends.base.BaseBackend(connection, **kwargs)¶
Base class for backends.
- ack(delivery_tag)¶
- Acknowledge the message.
- cancel(*args, **kwargs)¶
- Cancel the consumer.
- close()¶
- Close the backend.
- consume(*args, **kwargs)¶
- Start a consumer and return a iterator that can iterate over new messages.
- decoder()¶
- decode(string, all_unicode=False) -> parse the JSON representation into python objects. The optional argument `all_unicode’, specifies how to convert the strings in the JSON representation into python objects. If it is False (default), it will return strings everywhere possible and unicode objects only where necessary, else it will return unicode objects everywhere (this is slower).
- encoder()¶
- encode(object) -> generate the JSON representation for object.
- exchange_declare(*args, **kwargs)¶
- Declare an exchange by name.
- get(*args, **kwargs)¶
- Pop a message off the queue.
- message_to_python(raw_message)¶
- Convert received message body to a python datastructure.
- prepare_message(message_data, delivery_mode, **kwargs)¶
- Prepare message for sending.
- publish(message, exchange, routing_key, **kwargs)¶
- Publish a message.
- queue_bind(*args, **kwargs)¶
- Bind a queue to an exchange.
- queue_declare(*args, **kwargs)¶
- Declare a queue by name.
- reject(delivery_tag)¶
- Reject the message.
- requeue(delivery_tag)¶
- Requeue the message.
- class carrot.backends.base.BaseMessage(backend, **kwargs)¶
Base class for received messages.
- ack()¶
Acknowledge this message as being processed.,
This will remove the message from the queue.
- decode()¶
- Deserialize the message body, returning the original python structure sent by the publisher.
- reject()¶
Reject this message.
The message will be discarded by the server.
- requeue()¶
Reject this message and put it back on the queue.
You must not use this method as a means of selecting messages to process.