kombu 1.0.2

AMQP Messaging Framework for Python

Synopsis

Kombu is an AMQP messaging framework for Python.

AMQP is the Advanced Message Queuing Protocol, an open standard protocol for message orientation, queuing, routing, reliability and security.

One of the most popular implementations of AMQP is RabbitMQ.

The aim of Kombu is to make messaging in Python as easy as possible by providing an idiomatic high-level interface for the AMQP protocol, and also provide proven and tested solutions to common messaging problems.

Features

  • Allows application authors to support several message server solutions by using pluggable transports.

    • AMQP transports for both the amqplib (sync) and pika (sync + async) clients.
    • Virtual transports makes it really easy to add support for non-AMQP transports. There is already built-in support for Redis, Beanstalk, CouchDB, and MongoDB.
    • SQLAlchemy and Django ORM transports exists as plug-ins ( kombu-sqlalchemy and django-kombu).
    • In-memory transport for unit testing.
  • Supports automatic encoding, serialization and compression of message payloads.

  • Consistent exception handling across transports.

  • The ability to ensure that an operation is performed by gracefully handling connection and channel errrors.

  • Several annoyances with amqplib has been fixed, like supporting timeouts and the ability to wait for events on more than one channel.

  • Projects already using carrot can easily be ported by using a compatibility layer.

For an introduction to AMQP you should read the article Rabbits and warrens, and the Wikipedia article about AMQP.

Transport Comparison

Client Type Direct Topic Fanout
amqplib Native Yes Yes Yes
pika Native Yes Yes Yes
redis Virtual Yes Yes[*]_ Yes (PUB/SUB)
beanstalk Virtual Yes Yes[*]_ No
mongodb Virtual Yes Yes[*]_ No
couchdb Virtual Yes Yes[*]_ No
in-memory Virtual Yes Yes[*]_ No
[*]Declarations only kept in memory, so exchanges/queues must be declared by all clients that needs them.

Documentation

Kombu is using Sphinx, and the latest documentation is available at GitHub:

http://ask.github.com/kombu

Quick overview

from kombu.connection import BrokerConnection
from kombu.messaging import Exchange, Queue, Consumer, Producer

media_exchange = Exchange("media", "direct", durable=True)
video_queue = Queue("video", exchange=media_exchange, key="video")

# connections/channels
connection = BrokerConnection("localhost", "guest", "guest", "/")
channel = connection.channel()

# produce
producer = Producer(channel, exchange=media_exchange, serializer="json")
producer.publish({"name": "/tmp/lolcat1.avi", "size": 1301013})

# consume
consumer = Consumer(channel, video_queue)
consumer.register_callback(process_media)
consumer.consume()

# Process messages on all channels
while True:
    connection.drain_events()

# Consume from several queues on the same channel:
video_queue = Queue("video", exchange=media_exchange, key="video")
image_queue = Queue("image", exchange=media_exchange, key="image")

consumer = Consumer(channel, [video_queue, image_queue])
consumer.consume()

while True:
    connection.drain_events()

Exchange and Queue are simply declarations that can be pickled and used in configuaration files etc.

They also support operations, but to do so they need to be bound to a channel:

>>> exchange = Exchange("tasks", "direct")

>>> connection = BrokerConnection()
>>> channel = connection.channel()
>>> bound_exchange = exchange(channel)
>>> bound_exchange.delete()

# the original exchange is not affected, and stays unbound.
>>> exchange.delete()
raise NotBoundError: Can't call delete on Exchange not bound to
    a channel.

Installation

You can install Kombu either via the Python Package Index (PyPI) or from source.

To install using pip,:

$ pip install kombu

To install using easy_install,:

$ easy_install kombu

If you have downloaded a source tarball you can install it by doing the following,:

$ python setup.py build
# python setup.py install # as root

Terminology

There are some concepts you should be familiar with before starting:

  • Producers

    Producers sends messages to an exchange.

  • Exchanges

    Messages are sent to exchanges. Exchanges are named and can be configured to use one of several routing algorithms. The exchange routes the messages to consumers by matching the routing key in the message with the routing key the consumer provides when binding to the exchange.

  • Consumers

    Consumers declares a queue, binds it to a exchange and receives messages from it.

  • Queues

    Queues receive messages sent to exchanges. The queues are declared by consumers.

  • Routing keys

    Every message has a routing key. The interpretation of the routing key depends on the exchange type. There are four default exchange types defined by the AMQP standard, and vendors can define custom types (so see your vendors manual for details).

    These are the default exchange types defined by AMQP/0.8:

    • Direct exchange

      Matches if the routing key property of the message and the routing_key attribute of the consumer are identical.

    • Fan-out exchange

      Always matches, even if the binding does not have a routing key.

    • Topic exchange

      Matches the routing key property of the message by a primitive pattern matching scheme. The message routing key then consists of words separated by dots (".", like domain names), and two special characters are available; star ("*") and hash ("#"). The star matches any word, and the hash matches zero or more words. For example "*.stock.#" matches the routing keys "usd.stock" and "eur.stock.db" but not "stock.nasdaq".

Getting Help

Mailing list

Join the carrot-users mailing list.

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to our issue tracker at http://github.com/ask/kombu/issues/

Contributing

Development of Kombu happens at Github: http://github.com/ask/kombu

You are highly encouraged to participate in the development. If you don't like Github (for some reason) you're welcome to send regular patches.

License

This software is licensed under the New BSD License. See the LICENSE file in the top distribution directory for the full license text.

Author

Ask Solem

Pip

kombu==1.0.2

Classifiers

  • Topic :: System :: Distributed Computing
  • Topic :: Software Development :: Libraries :: Python Modules
  • Topic :: Communications
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python :: 2.6
  • Programming Language :: Python :: 2.5
  • Programming Language :: Python :: 2.4
  • Programming Language :: Python :: 2
  • Programming Language :: Python
  • Operating System :: OS Independent
  • License :: OSI Approved :: BSD License
  • Intended Audience :: Developers
  • Framework :: Django
  • Development Status :: 4 - Beta
File Type Python Version Uploaded On Downloads
kombu-1.0.2.zip Source Feb. 1, 2011 6,206
kombu-1.0.2.tar.gz Source Jan. 31, 2011 12,969
kombu-1.0.2.tar.bz2 Source Feb. 1, 2011 6,595
Version Release Date
3.0.24 Nov. 18, 2014
3.0.23 Sept. 14, 2014
3.0.22 Sept. 4, 2014
3.0.21 July 7, 2014
3.0.20 June 24, 2014
3.0.19 June 9, 2014
3.0.18 June 2, 2014
3.0.17-20140602 April 18, 2015
3.0.17 June 2, 2014
3.0.16 May 6, 2014
3.0.15 April 15, 2014
3.0.14 March 19, 2014
3.0.13 March 3, 2014
3.0.12 Feb. 9, 2014
3.0.11 Feb. 3, 2014
3.0.10 Jan. 17, 2014
3.0.9 Jan. 13, 2014
3.0.8 Dec. 16, 2013
3.0.7 Dec. 2, 2013
3.0.6 Nov. 21, 2013
3.0.5 Nov. 15, 2013
3.0.4 Nov. 8, 2013
3.0.3 Nov. 4, 2013
3.0.2 Oct. 29, 2013
3.0.1 Oct. 24, 2013
3.0.0 Oct. 14, 2013
2.5.16 Oct. 23, 2013
2.5.15 Oct. 4, 2013
2.5.14 Aug. 23, 2013
2.5.13 Aug. 16, 2013
2.5.12 June 28, 2013
2.5.11 June 25, 2013
2.5.10 April 11, 2013
2.5.9 April 8, 2013
2.5.8 March 21, 2013
2.5.7 March 8, 2013
2.5.6 Feb. 8, 2013
2.5.5 Feb. 7, 2013
2.5.4 Dec. 10, 2012
2.5.3 Nov. 29, 2012
2.5.2 Nov. 29, 2012
2.5.1 Nov. 28, 2012
2.5.0 Nov. 27, 2012
2.4.10 Nov. 22, 2012
2.4.9 Nov. 21, 2012
2.4.8 Nov. 2, 2012
2.4.7 Sept. 18, 2012
2.4.6 Sept. 12, 2012
2.4.5 Aug. 30, 2012
2.4.4 Aug. 29, 2012
2.4.3 Aug. 25, 2012
2.4.2 Aug. 24, 2012
2.4.1 Aug. 24, 2012
2.4.0 Aug. 17, 2012
2.3.2 Aug. 1, 2012
2.3.1 Aug. 1, 2012
2.3.0 July 24, 2012
2.2.6 July 10, 2012
2.2.5 July 10, 2012
2.2.4 July 5, 2012
2.2.3 June 24, 2012
2.2.2 June 22, 2012
2.2.1 June 21, 2012
2.2.0 June 7, 2012
2.1.8 May 6, 2012
2.1.7 April 27, 2012
2.1.6 April 23, 2012
2.1.5 April 13, 2012
2.1.4 April 10, 2012
2.1.3 April 3, 2012
2.1.2 March 20, 2012
2.1.1 Feb. 24, 2012
2.1.0 Feb. 4, 2012
2.0.0 Jan. 15, 2012
1.5.1 Nov. 30, 2011
1.5.0 Nov. 27, 2011
1.4.3 Oct. 27, 2011
1.4.2 Oct. 26, 2011
1.4.1 Sept. 26, 2011
1.4.0 Sept. 22, 2011
1.3.5 Sept. 16, 2011
1.3.4 Sept. 16, 2011
1.3.3 Sept. 15, 2011
1.3.2 Sept. 10, 2011
1.3.1 Sept. 7, 2011
1.3.0 Sept. 5, 2011
1.2.1 July 29, 2011
1.2.0 July 15, 2011
1.1.6 June 13, 2011
1.1.5 June 7, 2011
1.1.4 June 7, 2011
1.1.3 April 21, 2011
1.1.2 April 6, 2011
1.1.1 April 5, 2011
1.1.0 April 5, 2011
1.0.7 March 28, 2011
1.0.6 March 22, 2011
1.0.5 March 17, 2011
1.0.4 Feb. 28, 2011
1.0.3 Feb. 12, 2011
1.0.2 Jan. 31, 2011
1.0.1 Jan. 28, 2011
1.0.0rc4 Jan. 25, 2011
1.0.0rc3 Jan. 21, 2011
1.0.0rc2 Jan. 13, 2011
1.0.0rc1 Jan. 12, 2011
1.0.0 Jan. 27, 2011
1.0.0b4 Jan. 7, 2011
1.0.0b3 Jan. 7, 2011
1.0.0b2 Jan. 3, 2011
1.0.0b1 Dec. 18, 2010
0.9.7 Nov. 30, 2010
0.9.6 Nov. 12, 2010
0.9.5 Nov. 11, 2010
0.9.4 Nov. 10, 2010
0.9.2 Nov. 10, 2010
0.9.1 Oct. 27, 2010
0.9.0 Oct. 21, 2010
0.2.0 Sept. 20, 2010
0.1.0 July 22, 2010
Date Package Version Action
April 18, 2015, 6:02 p.m. kombu 3.0.22 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.23 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.20 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.21 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.8 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.24 Release Created
April 18, 2015, 6:02 p.m. kombu 1.3.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.10 Release Created
April 18, 2015, 6:02 p.m. kombu 1.3.2 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.0 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.3 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.2 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.5 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.4 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.7 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.6 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.9 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.8 Release Created
April 18, 2015, 6:02 p.m. kombu 2.3.2 Release Created
April 18, 2015, 6:02 p.m. kombu 2.3.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.3.0 Release Created
April 18, 2015, 6:02 p.m. kombu 0.9.7 Release Created
April 18, 2015, 6:02 p.m. kombu 0.9.6 Release Created
April 18, 2015, 6:02 p.m. kombu 0.9.5 Release Created
April 18, 2015, 6:02 p.m. kombu 0.9.4 Release Created
April 18, 2015, 6:02 p.m. kombu 1.4.3 Release Created
April 18, 2015, 6:02 p.m. kombu 1.4.2 Release Created
April 18, 2015, 6:02 p.m. kombu 1.4.1 Release Created
April 18, 2015, 6:02 p.m. kombu 1.4.0 Release Created
April 18, 2015, 6:02 p.m. kombu 0.9.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.5 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.4 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.7 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.6 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.0 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.3 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.2 Release Created
April 18, 2015, 6:02 p.m. kombu 0.2.0 Release Created
April 18, 2015, 6:02 p.m. kombu 0.9.0 Release Created
April 18, 2015, 6:02 p.m. kombu 2.1.8 Release Created
April 18, 2015, 6:02 p.m. kombu 0.1.0 Release Created
April 18, 2015, 6:02 p.m. kombu 1.1.6 Release Created
April 18, 2015, 6:02 p.m. kombu 1.1.4 Release Created
April 18, 2015, 6:02 p.m. kombu 1.1.5 Release Created
April 18, 2015, 6:02 p.m. kombu 1.1.2 Release Created
April 18, 2015, 6:02 p.m. kombu 1.1.3 Release Created
April 18, 2015, 6:02 p.m. kombu 1.1.0 Release Created
April 18, 2015, 6:02 p.m. kombu 1.1.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.4 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.5 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.6 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.7 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.0 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.2 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.3 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.11 Release Created
April 18, 2015, 6:02 p.m. kombu 1.3.5 Release Created
April 18, 2015, 6:02 p.m. kombu 1.3.0 Release Created
April 18, 2015, 6:02 p.m. kombu 2.4.9 Release Created
April 18, 2015, 6:02 p.m. kombu 2.5.10 Release Created
April 18, 2015, 6:02 p.m. kombu 1.3.3 Release Created
April 18, 2015, 6:02 p.m. kombu 1.5.0 Release Created
April 18, 2015, 6:02 p.m. kombu 1.5.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.2.2 Release Created
April 18, 2015, 6:02 p.m. kombu 2.2.3 Release Created
April 18, 2015, 6:02 p.m. kombu 2.2.0 Release Created
April 18, 2015, 6:02 p.m. kombu 2.2.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.2.6 Release Created
April 18, 2015, 6:02 p.m. kombu 2.2.4 Release Created
April 18, 2015, 6:02 p.m. kombu 2.2.5 Release Created
April 18, 2015, 6:02 p.m. kombu 1.2.1 Release Created
April 18, 2015, 6:02 p.m. kombu 2.0.0 Release Created
April 18, 2015, 6:02 p.m. kombu 1.2.0 Release Created
April 18, 2015, 6:02 p.m. kombu 1.0.0b3 Release Created
April 18, 2015, 6:02 p.m. kombu 1.0.0b2 Release Created
April 18, 2015, 6:02 p.m. kombu 1.0.0b1 Release Created
April 18, 2015, 6:02 p.m. kombu 1.0.0b4 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.9 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.8 Release Created
April 18, 2015, 6:02 p.m. kombu 0.9.2 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.1 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.0 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.3 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.2 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.5 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.4 Release Created
April 18, 2015, 6:02 p.m. kombu 3.0.7 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.6 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.17-20140602 Release Created
April 18, 2015, 6:01 p.m. kombu 2.5.16 Release Created
April 18, 2015, 6:01 p.m. kombu 2.5.15 Release Created
April 18, 2015, 6:01 p.m. kombu 2.5.14 Release Created
April 18, 2015, 6:01 p.m. kombu 2.5.13 Release Created
April 18, 2015, 6:01 p.m. kombu 2.5.12 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.19 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.18 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.17 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.16 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.15 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.14 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.13 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.12 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.11 Release Created
April 18, 2015, 6:01 p.m. kombu 3.0.10 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.0rc4 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.0rc3 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.0rc2 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.0rc1 Release Created
April 18, 2015, 6:01 p.m. kombu 1.3.4 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.3 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.2 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.1 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.0 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.7 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.6 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.5 Release Created
April 18, 2015, 6:01 p.m. kombu 1.0.4 Release Created
April 18, 2015, 6:01 p.m. kombu Package Created