carrot.backends.base — Carrot v0.10.5 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Carrot v0.10.5 documentation »
- API Reference »

# 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.

  `close_connection`(connection)

    Close the connection.

  `consume`(*args, **kwargs)

    Iterate over the declared consumers.

  `establish_connection`()

    Establish a connection to the backend.

  `exchange_declare`(*args, **kwargs)

    Declare an exchange by name.

  `flow`(active)

    Enable/disable flow from peer.

  `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.

  `purge`(queue, **kwargs)

    Discard all messages in the queue.

  `qos`(prefetch_size, prefetch_count, apply_global=False)

    Request specific Quality of Service.

  `queue_bind`(*args, **kwargs)

    Bind a queue to an exchange.

  `queue_declare`(*args, **kwargs)

    Declare a queue by name.

  `queue_delete`(*args, **kwargs)

    Delete a queue by name.

  `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 the message.

  `requeue`(delivery_tag)

    Requeue the message.

class `carrot.backends.base.` `BaseMessage`(backend, **kwargs)

  Base class for received messages.

  exception `MessageStateError`

    The message has already been acknowledged.

  `BaseMessage.` `ack`()

    Acknowledge this message as being processed., This will remove the message from the queue.

    Raises MessageStateError:
    | If the message has already been acknowledged/requeued/rejected.

  `BaseMessage.` `decode`()

    Deserialize the message body, returning the original python structure sent by the publisher.

  `BaseMessage.` `payload`

    The decoded message.

  `BaseMessage.` `reject`()

    Reject this message.

    The message will be discarded by the server.

    Raises MessageStateError:
    | If the message has already been acknowledged/requeued/rejected.

  `BaseMessage.` `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.

    Raises MessageStateError:
    | If the message has already been acknowledged/requeued/rejected.

exception `carrot.backends.base.` `MessageStateError`

  The message has already been acknowledged.

### Navigation

- index
- modules |
- next |
- previous |
- Carrot v0.10.5 documentation »
- API Reference »