Compare commits

...

7 Commits

Author SHA1 Message Date
Jérôme Schneider c9d5c5a01b debian: remove python3 support and simply packaging 2014-11-03 10:28:23 +01:00
Jérôme Schneider 5534791727 kombu: add install file for python-kombu and python3-kombu 2014-11-03 10:18:39 +01:00
Jérôme Schneider 0469b8bbbc rules: don't use pybuild 2014-11-01 19:15:35 +01:00
Jérôme Schneider ea3314d575 control: remove pymongo build dependency 2014-11-01 19:12:06 +01:00
Jérôme Schneider 4465e215ac control: cleanning build dependencies 2014-11-01 19:09:09 +01:00
Jérôme Schneider 87b3619e5b debian: initial import 2014-10-31 18:14:26 +01:00
Jérôme Schneider 2e49221442 remove kombu source from debian branch 2014-10-31 17:36:47 +01:00
281 changed files with 402 additions and 34800 deletions

118
AUTHORS
View File

@ -1,118 +0,0 @@
=========
AUTHORS
=========
:order: sorted
Adam Gaca <adam.gaca@oke.pl>
Adam Nelson <adam@varud.com>
Adam Wentz
Alex Koshelev <daevaorn@gmail.com>
Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
Andrew Watts
Andrey Antukh <niwi@niwi.be>
Andrii Kostenko <andrey@kostenko.name>
Andy McCurdy <andy@andymccurdy.com>
Antoine Legrand <antoine.legrand@smartjog.com>
Anton Gyllenberg <anton@iki.fi>
Ask Solem <ask@celeryproject.org>
Basil Mironenko <bmironenko@ddn.com>
Bobby Beever <bobby.beever@yahoo.com>
Brian Bernstein
C Anthony Risinger <anthony+corvisa.com@xtfx.me>
Christophe Chauvet <christophe.chauvet@gmail.com>
Christopher Grebs <cg@webshox.org>
Clay Gerrard <clay.gerrard@gmail.com>
Corentin Ardeois <cardeois@iweb.com>
Dan LaMotte <lamotte85@gmail.com>
Dan McGee <dan@archlinux.org>
Dane Guempel <daneguempel@gmail.com>
Davanum Srinivas <dims@linux.vnet.ibm.com>
David Clymer <david@zettazebra.com>
David Gelvin <david.gelvin@gmail.com>
David Strauss <david@davidstrauss.net>
David Ziegler <david.ziegler@gmail.com>
Dhananjay Nene <dhananjay.nene@gmail.com>
Dmitry Malinovsky <dmalinovsky@thumbtack.net>
Dustin J. Mitchell <dustin@mozilla.com>
Ephemera <obliviscence+git@gmail.com>
Eric Reynolds <ereynolds@opendns.com>
Fabrice Rabaute <fabrice@expa.com>
Felix Schwarz <felix.schwarz@oss.schwarz.eu>
Fernando Jorge Mota <f.j.mota13@gmail.com>
Flavio [FlaPer87] Percoco Premoli <flaper87@flaper87.org>
Florian Munz <surf@theflow.de>
Franck Cuny <fcuny@saymedia.com>
Germán M. Bravo <german.mb@gmail.com>
Gregory Haskins <greg@greghaskins.com>
Hong Minhee <minhee@dahlia.kr>
Ian Eure <ian.eure@gmail.com>
Ian Struble <istruble@gmail.com>
Ionel Maries Cristian <contact@ionelmc.ro>
James Saryerwinnie <js@jamesls.com>
James Turk <james.p.turk@gmail.com>
Jason Cater <jason@ncsfulfillment.com>
Jasper Bryant-Greene <jbg@rf.net.nz>
Jeff Balogh <me@jeffbalogh.org>
Jesper Thomschütz <jesper@jespersaur.com>
John Shuping <jshuping@acm.org>
John Spray <jcspray@gmail.com>
John Watson <john@disqus.com>
Jonathan Halcrow <jonathan.halcrow@gmail.com>
Joseph Crosland <jcrosland@flumotion.com>
Keith Fitzgerald <ghostrocket@me.com>
Kevin McCarthy <me@kevinmccarthy.org>
Kevin McDonald <k3vinmcdonald@gmail.com>
Latitia M. Haskins <lhaskins@jetsonsys.com>
Len Buckens <buckens.len@gmail.com>
Mahendra M <Mahendra_M@infosys.com>
Marcin Lulek (ergo) <info@webreactor.eu>
Mark Lavin <mlavin@caktusgroup.com>
Matt Wise <wise@wiredgeek.net>
Maxime Rouyrre <rouyrre+git@gmail.com>
Mher Movsisyan <mher.movsisyan@gmail.com>
Michael Barrett <mb@eventbrite.com>
Michael Nelson <michaeln@telesign.com>
Nitzan Miron <bug.assembla@bugbug.me>
Noah Kantrowitz <noah@coderanger.net>
Ollie Walsh <ollie.walsh@geemail.kom>
Pascal Hartig <phartig@rdrei.net>
Patrick Schneider <patrick.p2k.schneider@gmail.com>
Paul McLanahan <paul@mclanahan.net>
Petar Radosevic <petar@wunki.org>
Peter Hoffmann <tosh54@gmail.com>
Pierre Riteau <priteau@ci.uchicago.edu>
Rafael Duran Castaneda <rafadurancastaneda@gmail.com>
Rafal Malinowski <malinowski@red-sky.pl>
Ralf Nyren <ralf-github@nyren.net>
Randy Barlow <rbarlow@redhat.com>
Rob Ottaway <robottaway@gmail.com>
Roger Hu <rhu@hearsaycorp.com>
Rumyana Neykova <rumi.neykova@gmail.com>
Rune Halvorsen <runeh@opera.com>
Ryan Petrello <lists@ryanpetrello.com>
Sam Stavinoha <smlstvnh@gmail.com>
Sascha Peilicke <saschpe@gmx.de>
Scott Lyons <scottalyons@gmail.com>
Sean Bleier <sebleier@gmail.com>
Sean Creeley <sean.creeley@gmail.com>
Seb Insua <sebastian.insua@saffrondigital.com>
Shane Caraveo <shane@caraveo.com>
Steeve Morin <steeve.morin@gmail.com>
Stefan Eletzhofer <se@nexiles.de>
Stephan Jaekel <steph@rdev.info>
Stephen Day <stevvooe@gmail.com>
Tareque Hossain
Thomas Johansson <prencher@prencher.dk>
Tobias Schottdorf <tobias@goshippo.com>
Tomaž Muraus <kami@k5-storitve.net>
Tommie McAfee <tommie@couchbase.com>
Travis Cline <travis.cline@gmail.com>
Travis Swicegood <development@domain51.com>
Victor Garcia <victor@tuenti.com>
Viet Hung Nguyen <hvnsweeting@gmail.com>
Vince Gonzalez <vince.gonzalez@gmail.com>
Vincent Driessen <vincent@datafox.nl>
Zach Smith <zmsmith27@gmail.com>
Zhao Xiaohong <mrluanma@gmail.com>
haridsv
iSlava <sig.crea@gmail.com>

3012
Changelog

File diff suppressed because it is too large Load Diff

16
FAQ
View File

@ -1,16 +0,0 @@
============================
Frequently Asked Questions
============================
Questions
=========
Q: Message.reject doesn't work?
--------------------------------------
**Answer**: Earlier versions of RabbitMQ did not implement ``basic.reject``,
so make sure your version is recent enough to support it.
Q: Message.requeue doesn't work?
--------------------------------------
**Answer**: See _`Message.reject doesn't work?`

21
INSTALL
View File

@ -1,21 +0,0 @@
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

26
LICENSE
View File

@ -1,26 +0,0 @@
Copyright (c) 2012-2014 GoPivotal, Inc. All rights reserved.
Copyright (c) 2009-2012, Ask Solem & contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Ask Solem nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Ask Solem OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,17 +0,0 @@
include AUTHORS
include Changelog
include FAQ
include INSTALL
include LICENSE
include MANIFEST.in
include README.rst
include README
include THANKS
include TODO
include setup.cfg
recursive-include extra *
recursive-include docs *
recursive-include kombu *.py
recursive-include requirements *.txt
recursive-include funtests *.py setup.cfg
recursive-include examples *.py

355
PKG-INFO
View File

@ -1,355 +0,0 @@
Metadata-Version: 1.1
Name: kombu
Version: 3.0.21
Summary: Messaging library for Python
Home-page: http://kombu.readthedocs.org
Author: Ask Solem
Author-email: ask@celeryproject.org
License: UNKNOWN
Description: .. _kombu-index:
========================================
kombu - Messaging library for Python
========================================
:Version: 3.0.21
`Kombu` is a messaging library for Python.
The aim of `Kombu` is to make messaging in Python as easy as possible by
providing an idiomatic high-level interface for the AMQ protocol, and also
provide proven and tested solutions to common messaging problems.
`AMQP`_ is the Advanced Message Queuing Protocol, an open standard protocol
for message orientation, queuing, routing, reliability and security,
for which the `RabbitMQ`_ messaging server is the most popular implementation.
Features
========
* Allows application authors to support several message server
solutions by using pluggable transports.
* AMQP transport using the `py-amqp`_ or `librabbitmq`_ client libraries.
* High performance AMQP transport written in C - when using `librabbitmq`_
This is automatically enabled if librabbitmq is installed::
$ pip install librabbitmq
* Virtual transports makes it really easy to add support for non-AMQP
transports. There is already built-in support for `Redis`_,
`Beanstalk`_, `Amazon SQS`_, `CouchDB`_, `MongoDB`_, `ZeroMQ`_,
`ZooKeeper`_, `SoftLayer MQ`_ and `Pyro`_.
* You can also use the SQLAlchemy and Django ORM transports to
use a database as the broker.
* 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 errors.
* 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`_.
.. _`RabbitMQ`: http://www.rabbitmq.com/
.. _`AMQP`: http://amqp.org
.. _`py-amqp`: http://pypi.python.org/pypi/amqp/
.. _`Redis`: http://code.google.com/p/redis/
.. _`Amazon SQS`: http://aws.amazon.com/sqs/
.. _`MongoDB`: http://www.mongodb.org/
.. _`CouchDB`: http://couchdb.apache.org/
.. _`ZeroMQ`: http://zeromq.org/
.. _`Zookeeper`: https://zookeeper.apache.org/
.. _`Beanstalk`: http://kr.github.com/beanstalkd/
.. _`Rabbits and warrens`: http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/
.. _`amqplib`: http://barryp.org/software/py-amqplib/
.. _`Wikipedia article about AMQP`: http://en.wikipedia.org/wiki/AMQP
.. _`carrot`: http://pypi.python.org/pypi/carrot/
.. _`librabbitmq`: http://pypi.python.org/pypi/librabbitmq
.. _`Pyro`: http://pythonhosting.org/Pyro
.. _`SoftLayer MQ`: http://www.softlayer.com/services/additional/message-queue
.. _transport-comparison:
Transport Comparison
====================
+---------------+----------+------------+------------+---------------+
| **Client** | **Type** | **Direct** | **Topic** | **Fanout** |
+---------------+----------+------------+------------+---------------+
| *amqp* | Native | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *redis* | Virtual | Yes | Yes | Yes (PUB/SUB) |
+---------------+----------+------------+------------+---------------+
| *mongodb* | Virtual | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *beanstalk* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *SQS* | Virtual | Yes | Yes [#f1]_ | Yes [#f2]_ |
+---------------+----------+------------+------------+---------------+
| *couchdb* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *zookeeper* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *in-memory* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *django* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *sqlalchemy* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *SLMQ* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
.. [#f1] Declarations only kept in memory, so exchanges/queues
must be declared by all clients that needs them.
.. [#f2] Fanout supported via storing routing tables in SimpleDB.
Disabled by default, but can be enabled by using the
``supports_fanout`` transport option.
Documentation
-------------
Kombu is using Sphinx, and the latest documentation can be found here:
http://kombu.readthedocs.org/
Quick overview
--------------
::
from kombu import Connection, Exchange, Queue
media_exchange = Exchange('media', 'direct', durable=True)
video_queue = Queue('video', exchange=media_exchange, routing_key='video')
def process_media(body, message):
print body
message.ack()
# connections
with Connection('amqp://guest:guest@localhost//') as conn:
# produce
producer = conn.Producer(serializer='json')
producer.publish({'name': '/tmp/lolcat1.avi', 'size': 1301013},
exchange=media_exchange, routing_key='video',
declare=[video_queue])
# the declare above, makes sure the video queue is declared
# so that the messages can be delivered.
# It's a best practice in Kombu to have both publishers and
# consumers declare the queue. You can also declare the
# queue manually using:
# video_queue(conn).declare()
# consume
with conn.Consumer(video_queue, callbacks=[process_media]) as consumer:
# Process messages and handle events on all channels
while True:
conn.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')
with connection.Consumer([video_queue, image_queue],
callbacks=[process_media]) as consumer:
while True:
connection.drain_events()
Or handle channels manually::
with connection.channel() as channel:
producer = Producer(channel, ...)
consumer = Producer(channel)
All objects can be used outside of with statements too,
just remember to close the objects after use::
from kombu import Connection, Consumer, Producer
connection = Connection()
# ...
connection.release()
consumer = Consumer(channel_or_connection, ...)
consumer.register_callback(my_callback)
consumer.consume()
# ....
consumer.cancel()
`Exchange` and `Queue` are simply declarations that can be pickled
and used in configuration files etc.
They also support operations, but to do so they need to be bound
to a channel.
Binding exchanges and queues to a connection will make it use
that connections default channel.
::
>>> exchange = Exchange('tasks', 'direct')
>>> connection = Connection()
>>> bound_exchange = exchange(connection)
>>> 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.
.. _`carrot-users`: http://groups.google.com/group/carrot-users/
Bug tracker
===========
If you have any suggestions, bug reports or annoyances please report them
to our issue tracker at http://github.com/celery/kombu/issues/
Contributing
============
Development of `Kombu` happens at Github: http://github.com/celery/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.
.. image:: https://d2weczhvl823v0.cloudfront.net/celery/kombu/trend.png
:alt: Bitdeli badge
:target: https://bitdeli.com/free
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: Implementation :: Jython
Classifier: Intended Audience :: Developers
Classifier: Topic :: Communications
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: System :: Networking
Classifier: Topic :: Software Development :: Libraries :: Python Modules

View File

@ -1,327 +0,0 @@
.. _kombu-index:
========================================
kombu - Messaging library for Python
========================================
:Version: 3.0.21
`Kombu` is a messaging library for Python.
The aim of `Kombu` is to make messaging in Python as easy as possible by
providing an idiomatic high-level interface for the AMQ protocol, and also
provide proven and tested solutions to common messaging problems.
`AMQP`_ is the Advanced Message Queuing Protocol, an open standard protocol
for message orientation, queuing, routing, reliability and security,
for which the `RabbitMQ`_ messaging server is the most popular implementation.
Features
========
* Allows application authors to support several message server
solutions by using pluggable transports.
* AMQP transport using the `py-amqp`_ or `librabbitmq`_ client libraries.
* High performance AMQP transport written in C - when using `librabbitmq`_
This is automatically enabled if librabbitmq is installed::
$ pip install librabbitmq
* Virtual transports makes it really easy to add support for non-AMQP
transports. There is already built-in support for `Redis`_,
`Beanstalk`_, `Amazon SQS`_, `CouchDB`_, `MongoDB`_, `ZeroMQ`_,
`ZooKeeper`_, `SoftLayer MQ`_ and `Pyro`_.
* You can also use the SQLAlchemy and Django ORM transports to
use a database as the broker.
* 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 errors.
* 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`_.
.. _`RabbitMQ`: http://www.rabbitmq.com/
.. _`AMQP`: http://amqp.org
.. _`py-amqp`: http://pypi.python.org/pypi/amqp/
.. _`Redis`: http://code.google.com/p/redis/
.. _`Amazon SQS`: http://aws.amazon.com/sqs/
.. _`MongoDB`: http://www.mongodb.org/
.. _`CouchDB`: http://couchdb.apache.org/
.. _`ZeroMQ`: http://zeromq.org/
.. _`Zookeeper`: https://zookeeper.apache.org/
.. _`Beanstalk`: http://kr.github.com/beanstalkd/
.. _`Rabbits and warrens`: http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/
.. _`amqplib`: http://barryp.org/software/py-amqplib/
.. _`Wikipedia article about AMQP`: http://en.wikipedia.org/wiki/AMQP
.. _`carrot`: http://pypi.python.org/pypi/carrot/
.. _`librabbitmq`: http://pypi.python.org/pypi/librabbitmq
.. _`Pyro`: http://pythonhosting.org/Pyro
.. _`SoftLayer MQ`: http://www.softlayer.com/services/additional/message-queue
.. _transport-comparison:
Transport Comparison
====================
+---------------+----------+------------+------------+---------------+
| **Client** | **Type** | **Direct** | **Topic** | **Fanout** |
+---------------+----------+------------+------------+---------------+
| *amqp* | Native | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *redis* | Virtual | Yes | Yes | Yes (PUB/SUB) |
+---------------+----------+------------+------------+---------------+
| *mongodb* | Virtual | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *beanstalk* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *SQS* | Virtual | Yes | Yes [#f1]_ | Yes [#f2]_ |
+---------------+----------+------------+------------+---------------+
| *couchdb* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *zookeeper* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *in-memory* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *django* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *sqlalchemy* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *SLMQ* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
.. [#f1] Declarations only kept in memory, so exchanges/queues
must be declared by all clients that needs them.
.. [#f2] Fanout supported via storing routing tables in SimpleDB.
Disabled by default, but can be enabled by using the
``supports_fanout`` transport option.
Documentation
-------------
Kombu is using Sphinx, and the latest documentation can be found here:
http://kombu.readthedocs.org/
Quick overview
--------------
::
from kombu import Connection, Exchange, Queue
media_exchange = Exchange('media', 'direct', durable=True)
video_queue = Queue('video', exchange=media_exchange, routing_key='video')
def process_media(body, message):
print body
message.ack()
# connections
with Connection('amqp://guest:guest@localhost//') as conn:
# produce
producer = conn.Producer(serializer='json')
producer.publish({'name': '/tmp/lolcat1.avi', 'size': 1301013},
exchange=media_exchange, routing_key='video',
declare=[video_queue])
# the declare above, makes sure the video queue is declared
# so that the messages can be delivered.
# It's a best practice in Kombu to have both publishers and
# consumers declare the queue. You can also declare the
# queue manually using:
# video_queue(conn).declare()
# consume
with conn.Consumer(video_queue, callbacks=[process_media]) as consumer:
# Process messages and handle events on all channels
while True:
conn.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')
with connection.Consumer([video_queue, image_queue],
callbacks=[process_media]) as consumer:
while True:
connection.drain_events()
Or handle channels manually::
with connection.channel() as channel:
producer = Producer(channel, ...)
consumer = Producer(channel)
All objects can be used outside of with statements too,
just remember to close the objects after use::
from kombu import Connection, Consumer, Producer
connection = Connection()
# ...
connection.release()
consumer = Consumer(channel_or_connection, ...)
consumer.register_callback(my_callback)
consumer.consume()
# ....
consumer.cancel()
`Exchange` and `Queue` are simply declarations that can be pickled
and used in configuration files etc.
They also support operations, but to do so they need to be bound
to a channel.
Binding exchanges and queues to a connection will make it use
that connections default channel.
::
>>> exchange = Exchange('tasks', 'direct')
>>> connection = Connection()
>>> bound_exchange = exchange(connection)
>>> 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.
.. _`carrot-users`: http://groups.google.com/group/carrot-users/
Bug tracker
===========
If you have any suggestions, bug reports or annoyances please report them
to our issue tracker at http://github.com/celery/kombu/issues/
Contributing
============
Development of `Kombu` happens at Github: http://github.com/celery/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.
.. image:: https://d2weczhvl823v0.cloudfront.net/celery/kombu/trend.png
:alt: Bitdeli badge
:target: https://bitdeli.com/free

32
THANKS
View File

@ -1,32 +0,0 @@
========
THANKS
========
From ``carrot`` THANKS file
===========================
* Thanks to Barry Pederson <bp@barryp.org> for the py-amqplib library.
* Thanks to Grégoire Cachet <gregoire@audacy.fr> for bug reports.
* Thanks to Martin Mahner for the Sphinx theme.
* Thanks to jcater for bug reports.
* Thanks to sebest for bug reports.
* Thanks to greut for bug reports
From ``django-kombu`` THANKS file
=================================
* Thanks to Rajesh Dhawan and other authors of django-queue-service
for the database model implementation.
See http://code.google.com/p/django-queue-service/.
From ``kombu-sqlalchemy`` THANKS file
=====================================
* Thanks to Rajesh Dhawan and other authors of django-queue-service
for the database model implementation.
See http://code.google.com/p/django-queue-service/.
* Thanks to haridsv for the draft SQLAlchemy port (which can still
be found at http://github.com/haridsv/celery-alchemy-poc)

2
TODO
View File

@ -1,2 +0,0 @@
Please see our Issue Tracker at GitHub:
http://github.com/celery/kombu/issues

187
debian/changelog vendored Normal file
View File

@ -0,0 +1,187 @@
kombu (3.0.21-2) unstable; urgency=low
* Python3 package. Closes: #754047.
* New upstream release. Closes: #757691.
* Remove recommends/build-depends on python-librabbitmq as it is still
broken.
-- Brian May <bam@debian.org> Mon, 11 Aug 2014 11:56:03 +1000
kombu (3.0.19-3) unstable; urgency=low
* Add python-librabbitmq (>= 1.5.2) to Recommends as a optional faster
transport than python-amqp.
* Add python-librabbitmq (>= 1.5.2) to Build-Depends to enable additional
tests during build.
* Drop versioned dependencies on python-amqp as there are no older releases
in the archive.
* Run wrap-and-sort on the packaging code.
-- Michael Fladischer <FladischerMichael@fladi.at> Sat, 09 Aug 2014 16:33:05 +0200
kombu (3.0.19-2) unstable; urgency=medium
[ Michael Fladischer ]
* Fix output redirection for nose tests used in autopkgtest (see #460242).
[ Brian May ]
* Remove depends on python-librabbitmq, as python-librabbitmq is broken
(see #747270). python-amqp should be sufficient.
-- Brian May <bam@debian.org> Tue, 22 Jul 2014 15:20:26 +1000
kombu (3.0.19-1) unstable; urgency=low
* New upstream release.
* Add autopkgtest that runs the upstream test suite against the installed
package.
-- Michael Fladischer <FladischerMichael@fladi.at> Mon, 23 Jun 2014 10:30:21 +0200
kombu (3.0.15-1) unstable; urgency=low
* New upstream release.
* Update Dependencies on python-amqp to (>= 1.4.5).
* Add python-redis to Build-Depends to allow tests for the redis transport
to run and add it to Suggests to for anyone who uses it as a transport.
* Add python-msgpack to Build-Depends in order to enable further tests.
-- Michael Fladischer <FladischerMichael@fladi.at> Wed, 23 Apr 2014 14:13:53 +0200
kombu (3.0.14-1) unstable; urgency=low
* New upstream release.
* Make Depends and Build-Depends on python-pymongo versioned (>=
2.6.2), thanks to Benjamin Drung.
* Check PGP signature on upstream tarball:
+ Add signature URL to debian/watch.
+ Include upstream public PGP key 030A2708.
+ Allow debian/upstream-signing-key.pgp to be included as a binary.
* Add patch to remove usage of remote-hosted images in documentation.
* Remove .PHONY declarations from debian/rules.
-- Michael Fladischer <FladischerMichael@fladi.at> Thu, 10 Apr 2014 13:14:55 +0200
kombu (3.0.12-1) unstable; urgency=medium
* New upstream release.
* Refresh remove_nose-cover3.patch.
* Drop remove_nose-cover3.patch, no longer needed.
* Bump Build-Depends and Depends on python-ampq to >= 1.4.3.
-- Michael Fladischer <FladischerMichael@fladi.at> Tue, 11 Feb 2014 11:10:49 +0100
kombu (3.0.7-1) unstable; urgency=low
* New upstream release.
* No longer supports python 2.5, reflect in X-Python-Version.
* Bump Standards version to 3.9.5.
* Bump Depends and Build-Depends on python-amqp to >= 1.3.3.
* Bump upper version limit for Build-Depends on python-amqp to (<<
2.0).
* Refresh patch.
* README was renamed to README.rst.
* Add kombu.egg-info/requires.txt do debian/clean.
* Make Build-Depends on python-all and python-pika unversioned as no
prior versions are available in Wheezy.
-- Michael Fladischer <FladischerMichael@fladi.at> Wed, 11 Dec 2013 11:22:10 +0100
kombu (2.5.15-1) unstable; urgency=low
* New upstream release.
-- Michael Fladischer <FladischerMichael@fladi.at> Mon, 07 Oct 2013 11:40:35 +0200
kombu (2.5.14-1) unstable; urgency=low
* New upstream release.
* Bump debhelper Build-Depends to >= 8.1.0~.
* Bump Standards version to 3.9.4.
* Bump Depends and Build-Depends on python-amqp to >= 1.0.13.
* Add python-librabbitmq to Build-Depends and Depends as the preferred
alternative to python-amqp.
* Add python-beanstalkc to Build-Depends and Suggests.
* Drop temporary workaround for Metadata-Version in d/rules.
-- Michael Fladischer <FladischerMichael@fladi.at> Mon, 02 Sep 2013 19:40:58 +0200
kombu (2.5.12-1) unstable; urgency=low
[ Thomas Goirand ]
* Team upload.
* New upstream release.
* Now depending on new python-amqp instead of python-amqplib.
[ Jakub Wilk <jwilk@debian.org> ]
* Use canonical URIs for Vcs-* fields.
[ Michael Fladischer <FladischerMichael@fladi.at> ]
* Bump dependency on python-anyjson to >= 0.3.3.
* Refresh patches.
-- Thomas Goirand <zigo@debian.org> Thu, 27 Jun 2013 09:32:47 +0000
kombu (2.1.8-1) unstable; urgency=low
* New upstream release.
-- Michael Fladischer <FladischerMichael@fladi.at> Mon, 23 Apr 2012 15:20:01 +0200
kombu (2.1.2-1) unstable; urgency=low
* New upstream release.
* Update years in d/copyright.
* Bump to standards version 3.9.3.
* Update DEP-5 URL to 1.0.
-- Michael Fladischer <FladischerMichael@fladi.at> Tue, 27 Mar 2012 16:54:58 +0100
kombu (2.1.0-1) unstable; urgency=low
* New upstream release (Closes: #611895).
* Add python-pika, python-sqlalchemy and python-django to Suggests/B-D
because of new transports.
* Increase X-Python-Version because python 2.4 is not longer supported
by upstream in 2.x releases.
* Add python-mock to B-D because tests require it.
* Make Metadata-Version fix more generic.
* Change order of my name.
* Update patch.
* Add NEWS file to inform about backwards-incompatible changes to transports.
-- Michael Fladischer <FladischerMichael@fladi.at> Wed, 22 Feb 2012 15:11:14 +0200
kombu (1.4.3-1) unstable; urgency=low
[ Fladischer Michael ]
* New upstream release.
* Temporary fix for Metadata-Version in PKG-INFO.
[ Jakub Wilk ]
* Bump minimum required python-sphinx version to 1.0.7+dfsg.
[ Fladischer Michael ]
* Fix whitespace in versioned dependencies.
-- Fladischer Michael <FladischerMichael@fladi.at> Thu, 17 Nov 2011 10:56:00 +0100
kombu (1.2.1-1) unstable; urgency=low
* New upstream release.
* Depend on python-anyjson (>=0.3.1), therefor no longer recommend
python-simplejson.
* Remove ${python:Breaks} as dh_python2 no longer needs it.
* Bumped Standards-Version to 3.9.2 (no change necessary).
* Add version to Breaks: python-cjson (<= 1.0.5-4+b1).
* Add python-boto to dependencies.
* Clean up after build.
* Use dh_sphinxdoc.
-- Fladischer Michael <FladischerMichael@fladi.at> Mon, 05 Sep 2011 23:18:16 +0200
kombu (1.0.4-1) unstable; urgency=low
* Initial release (Closes: #611809)
-- Fladischer Michael <FladischerMichael@fladi.at> Mon, 07 Mar 2011 12:53:13 +0200

2
debian/clean vendored Normal file
View File

@ -0,0 +1,2 @@
kombu.egg-info/SOURCES.txt
kombu.egg-info/requires.txt

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
7

40
debian/control vendored Normal file
View File

@ -0,0 +1,40 @@
Source: kombu
Section: python
Priority: optional
Maintainer: Jerome Schneider <jschneider@entrouvert.com>
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7)
Build-Conflicts: python-cjson
X-Python-Version: >= 2.6
Standards-Version: 3.9.5
Homepage: http://github.com/ask/kombu/
Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/kombu/trunk/
Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/kombu/trunk/
Package: python-kombu
Architecture: all
Depends: python-amqp,
python-anyjson (>= 0.3.3),
${misc:Depends},
${python:Depends}
Recommends: python-yaml
Breaks: python-cjson (<= 1.0.5-4+b1)
Suggests: python-beanstalkc,
python-boto,
python-couchdb (>= 0.8),
python-django,
python-pika,
python-pymongo (>= 2.6.2),
python-redis,
python-sqlalchemy
Description: AMQP Messaging Framework for Python
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. It is meant
to replace the carrot library by providing a compatibility layer.
.
Features:
* Allows application authors to support several message server solutions by
using pluggable transports.
* Supports automatic encoding, serialization and compression of message
payloads.
* The ability to ensure that an operation is performed by gracefully handling
connection and channel errors.

105
debian/copyright vendored Normal file
View File

@ -0,0 +1,105 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: kombu
Upstream-Contact: Ask Solem <askh@opera.com>
Source: http://pypi.python.org/pypi/kombu/
Files: *
Copyright: 2009-2012, Ask Solem and contributors.
License: BSD-solem
Files: kombu/utils/functional.py
Copyright: 2001-2007, Python Software
License: PSF-2
Files: docs/_theme/celery/static/celery.css_t
Copyright: 2010, Armin Ronacher
License: BSD-solem
Files: kombu/transport/beanstalk.py
Copyright: 2010-2011, David Ziegler.
License: BSD-solem
Files: kombu/transport/mongodb.py
Copyright: 2010-2011, Flavio Percoco Premoli
License: BSD-solem
Files: kombu/transport/pycouchdb.py
Copyright: 2010-2011, David Clymer
License: BSD-solem
Files: debian/*
Copyright: 2012, Michael Fladischer <FladischerMichael@fladi.at>
License: BSD-solem
License: BSD-solem
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
Neither the name of Ask Solem nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
License: PSF-2
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
.
2. Subject to the terms and conditions of this License Agreement, PSF
hereby grants Licensee a nonexclusive, royalty-free, world-wide
license to reproduce, analyze, test, perform and/or display publicly,
prepare derivative works, distribute, and otherwise use Python
alone or in any derivative version, provided, however, that PSF's
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation; All Rights
Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
.
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
.
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.

27
debian/patches/remove_logo.patch vendored Normal file
View File

@ -0,0 +1,27 @@
Description: Remove github-hosted logo from documentation
Author: Michael Fladischer <FladischerMichael@fladi.at>
Last-Update: 2014-04-10
Forwarded: not-needed
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -69,7 +69,7 @@
html_theme = "celery"
html_theme_path = ["_theme"]
html_sidebars = {
- 'index': ['sidebarintro.html', 'sourcelink.html', 'searchbox.html'],
- '**': ['sidebarlogo.html', 'localtoc.html', 'relations.html',
+ 'index': ['sourcelink.html', 'searchbox.html'],
+ '**': ['localtoc.html', 'relations.html',
'sourcelink.html', 'searchbox.html'],
}
--- a/docs/introduction.rst
+++ b/docs/introduction.rst
@@ -321,7 +321,3 @@
This software is licensed under the `New BSD License`. See the `LICENSE`
file in the top distribution directory for the full license text.
-
-.. image:: https://d2weczhvl823v0.cloudfront.net/celery/kombu/trend.png
- :alt: Bitdeli badge
- :target: https://bitdeli.com/free

1
debian/patches/series vendored Normal file
View File

@ -0,0 +1 @@
remove_logo.patch

18
debian/python-kombu.NEWS vendored Normal file
View File

@ -0,0 +1,18 @@
kombu (2.1.0-1) unstable; urgency=low
This release adds support for two new transports.
django-kombu is now part of Kombu core.
If you have previously used django-kombu, then the entry in INSTALLED_APPS
must be changed from djkombu to kombu.transport.django:
INSTALLED_APPS = (..., "kombu.transport.django")
There is no need to recreate the tables, as the old tables will be
fully compatible with the new version.
kombu-sqlalchemy is now also part of Kombu core.
This change requires no code changes given that the sqlalchemy transport
alias is used.
-- Michael Fladischer <FladischerMichael@fladi.at> Mon, 16 Jan 2012 13:55:28 +0100

2
debian/python-kombu.docs vendored Normal file
View File

@ -0,0 +1,2 @@
README.rst
FAQ

14
debian/rules vendored Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/make -f
%:
dh $@ --with python2 --buildsystem=python_distutils
override_dh_auto_clean:
python setup.py clean -a
find . -name \*.pyc -exec rm {} \;
override_dh_auto_build:
python setup.py build --force
override_dh_auto_install:
python setup.py install --force --root=debian/python-kombu --no-compile -O0 --install-layout=deb

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

1
debian/source/include-binaries vendored Normal file
View File

@ -0,0 +1 @@
debian/upstream-signing-key.pgp

BIN
debian/upstream-signing-key.pgp vendored Normal file

Binary file not shown.

3
debian/watch vendored Normal file
View File

@ -0,0 +1,3 @@
version=3
opts=pgpsigurlmangle=s/$/.asc/ \
http://pypi.python.org/packages/source/k/kombu/kombu-([\d\.]+)\.tar\.gz

View File

View File

@ -1,7 +0,0 @@
<h3>Kombu</h3>
<p>
Kombu is a messaging library for Python.
</p>
<p class="logo"><a href="{{ pathto(master_doc) }}">
<img width="128" height="128" class="logo" src="http://cloud.github.com/downloads/celery/kombu/kombusmall.jpg" alt="Logo"/>
</a></p>

View File

@ -1,3 +0,0 @@
<p class="logo"><a href="{{ pathto(master_doc) }}">
<img class="logo" width="128" height="128" src="http://cloud.github.com/downloads/celery/kombu/kombusmall.jpg" alt="Logo"/>
</a></p>

View File

@ -1,75 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d .build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview over all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
clean:
-rm -rf .build/*
html:
mkdir -p .build/html .build/doctrees
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) .build/html
@echo
@echo "Build finished. The HTML pages are in .build/html."
pickle:
mkdir -p .build/pickle .build/doctrees
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) .build/pickle
@echo
@echo "Build finished; now you can process the pickle files."
web: pickle
json:
mkdir -p .build/json .build/doctrees
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) .build/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
mkdir -p .build/htmlhelp .build/doctrees
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) .build/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in .build/htmlhelp."
latex:
mkdir -p .build/latex .build/doctrees
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) .build/latex
@echo
@echo "Build finished; the LaTeX files are in .build/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
mkdir -p .build/changes .build/doctrees
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) .build/changes
@echo
@echo "The overview file is in .build/changes."
linkcheck:
mkdir -p .build/linkcheck .build/doctrees
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) .build/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in .build/linkcheck/output.txt."

View File

@ -1,90 +0,0 @@
"""Adds xref targets to the top of files."""
import sys
import os
testing = False
DONT_TOUCH = ('./index.txt', )
def target_name(fn):
if fn.endswith('.txt'):
fn = fn[:-4]
return '_' + fn.lstrip('./').replace('/', '-')
def process_file(fn, lines):
lines.insert(0, '\n')
lines.insert(0, '.. %s:\n' % target_name(fn))
try:
f = open(fn, 'w')
except IOError:
print("Can't open %s for writing. Not touching it." % fn)
return
try:
f.writelines(lines)
except IOError:
print("Can't write to %s. Not touching it." % fn)
finally:
f.close()
def has_target(fn):
try:
f = open(fn, 'r')
except IOError:
print("Can't open %s. Not touching it." % fn)
return (True, None)
readok = True
try:
lines = f.readlines()
except IOError:
print("Can't read %s. Not touching it." % fn)
readok = False
finally:
f.close()
if not readok:
return (True, None)
#print fn, len(lines)
if len(lines) < 1:
print("Not touching empty file %s." % fn)
return (True, None)
if lines[0].startswith('.. _'):
return (True, None)
return (False, lines)
def main(argv=None):
if argv is None:
argv = sys.argv
if len(argv) == 1:
argv.extend('.')
files = []
for root in argv[1:]:
for (dirpath, dirnames, filenames) in os.walk(root):
files.extend([(dirpath, f) for f in filenames])
files.sort()
files = [os.path.join(p, fn) for p, fn in files if fn.endswith('.txt')]
#print files
for fn in files:
if fn in DONT_TOUCH:
print("Skipping blacklisted file %s." % fn)
continue
target_found, lines = has_target(fn)
if not target_found:
if testing:
print '%s: %s' % (fn, lines[0]),
else:
print "Adding xref to %s" % fn
process_file(fn, lines)
else:
print "Skipping %s: already has a xref" % fn
if __name__ == '__main__':
sys.exit(main())

View File

@ -1,180 +0,0 @@
"""
Runs through a reST file looking for old-style literals, and helps replace them
with new-style references.
"""
import re
import sys
import shelve
try:
input = input
except NameError:
input = raw_input # noqa
refre = re.compile(r'``([^`\s]+?)``')
ROLES = (
'attr',
'class',
"djadmin",
'data',
'exc',
'file',
'func',
'lookup',
'meth',
'mod',
"djadminopt",
"ref",
"setting",
"term",
"tfilter",
"ttag",
# special
"skip",
)
ALWAYS_SKIP = [
"NULL",
"True",
"False",
]
def fixliterals(fname):
data = open(fname).read()
last = 0
new = []
storage = shelve.open("/tmp/literals_to_xref.shelve")
lastvalues = storage.get("lastvalues", {})
for m in refre.finditer(data):
new.append(data[last:m.start()])
last = m.end()
line_start = data.rfind("\n", 0, m.start())
line_end = data.find("\n", m.end())
prev_start = data.rfind("\n", 0, line_start)
next_end = data.find("\n", line_end + 1)
# Skip always-skip stuff
if m.group(1) in ALWAYS_SKIP:
new.append(m.group(0))
continue
# skip when the next line is a title
next_line = data[m.end():next_end].strip()
if next_line[0] in "!-/:-@[-`{-~" and \
all(c == next_line[0] for c in next_line):
new.append(m.group(0))
continue
sys.stdout.write("\n" + "-" * 80 + "\n")
sys.stdout.write(data[prev_start + 1:m.start()])
sys.stdout.write(colorize(m.group(0), fg="red"))
sys.stdout.write(data[m.end():next_end])
sys.stdout.write("\n\n")
replace_type = None
while replace_type is None:
replace_type = input(
colorize("Replace role: ", fg="yellow")).strip().lower()
if replace_type and replace_type not in ROLES:
replace_type = None
if replace_type == "":
new.append(m.group(0))
continue
if replace_type == "skip":
new.append(m.group(0))
ALWAYS_SKIP.append(m.group(1))
continue
default = lastvalues.get(m.group(1), m.group(1))
if default.endswith("()") and \
replace_type in ("class", "func", "meth"):
default = default[:-2]
replace_value = input(
colorize("Text <target> [", fg="yellow") +
default +
colorize("]: ", fg="yellow"),
).strip()
if not replace_value:
replace_value = default
new.append(":%s:`%s`" % (replace_type, replace_value))
lastvalues[m.group(1)] = replace_value
new.append(data[last:])
open(fname, "w").write("".join(new))
storage["lastvalues"] = lastvalues
storage.close()
def colorize(text='', opts=(), **kwargs):
"""
Returns your text, enclosed in ANSI graphics codes.
Depends on the keyword arguments 'fg' and 'bg', and the contents of
the opts tuple/list.
Returns the RESET code if no parameters are given.
Valid colors:
'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'
Valid options:
'bold'
'underscore'
'blink'
'reverse'
'conceal'
'noreset' - string will not be auto-terminated with the RESET code
Examples:
colorize('hello', fg='red', bg='blue', opts=('blink',))
colorize()
colorize('goodbye', opts=('underscore',))
print colorize('first line', fg='red', opts=('noreset',))
print 'this should be red too'
print colorize('and so should this')
print 'this should not be red'
"""
color_names = ('black', 'red', 'green', 'yellow',
'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1',
'underscore': '4',
'blink': '5',
'reverse': '7',
'conceal': '8'}
text = str(text)
code_list = []
if text == '' and len(opts) == 1 and opts[0] == 'reset':
return '\x1b[%sm' % RESET
for k, v in kwargs.iteritems():
if k == 'fg':
code_list.append(foreground[v])
elif k == 'bg':
code_list.append(background[v])
for o in opts:
if o in opt_dict:
code_list.append(opt_dict[o])
if 'noreset' not in opts:
text = text + '\x1b[%sm' % RESET
return ('\x1b[%sm' % ';'.join(code_list)) + text
if __name__ == '__main__':
try:
fixliterals(sys.argv[1])
except (KeyboardInterrupt, SystemExit):
print

View File

@ -1,394 +0,0 @@
/*
* celery.css_t
* ~~~~~~~~~~~~
*
* :copyright: Copyright 2010 by Armin Ronacher.
* :license: BSD, see LICENSE for details.
*/
{% set page_width = 940 %}
{% set sidebar_width = 220 %}
{% set body_font_stack = 'Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif' %}
{% set headline_font_stack = 'Futura, "Trebuchet MS", Arial, sans-serif' %}
{% set code_font_stack = "'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace" %}
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
align: left;
font-family: {{ body_font_stack }};
font-size: 17px;
background-color: white;
color: #000;
margin: 30px 0 0 0;
padding: 0;
}
div.document {
width: {{ page_width }}px;
margin: 0 auto;
}
div.related {
width: {{ page_width - 20 }}px;
padding: 5px 10px;
background: #F2FCEE;
margin: 15px auto 15px auto;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 {{ sidebar_width }}px;
}
div.sphinxsidebar {
width: {{ sidebar_width }}px;
}
hr {
border: 1px solid #B1B4B6;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 0 30px;
}
img.celerylogo {
padding: 0 0 10px 10px;
float: right;
}
div.footer {
width: {{ page_width - 15 }}px;
margin: 10px auto 30px auto;
padding-right: 15px;
font-size: 14px;
color: #888;
text-align: right;
}
div.footer a {
color: #888;
}
div.sphinxsidebar a {
color: #444;
text-decoration: none;
border-bottom: 1px dashed #DCF0D5;
}
div.sphinxsidebar a:hover {
border-bottom: 1px solid #999;
}
div.sphinxsidebar {
font-size: 14px;
line-height: 1.5;
}
div.sphinxsidebarwrapper {
padding: 7px 10px;
}
div.sphinxsidebarwrapper p.logo {
padding: 0 0 20px 0;
margin: 0;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: {{ headline_font_stack }};
color: #444;
font-size: 24px;
font-weight: normal;
margin: 0 0 5px 0;
padding: 0;
}
div.sphinxsidebar h4 {
font-size: 20px;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p.logo a,
div.sphinxsidebar h3 a,
div.sphinxsidebar p.logo a:hover,
div.sphinxsidebar h3 a:hover {
border: none;
}
div.sphinxsidebar p {
color: #555;
margin: 10px 0;
}
div.sphinxsidebar ul {
margin: 10px 0;
padding: 0;
color: #000;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: {{ body_font_stack }};
font-size: 1em;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #348613;
text-decoration: underline;
}
a:hover {
color: #59B833;
text-decoration: underline;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: {{ headline_font_stack }};
font-weight: normal;
margin: 30px 0px 10px 0px;
padding: 0;
}
div.body h1 { margin-top: 0; padding-top: 0; font-size: 200%; }
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
div.body h1 a.toc-backref,
div.body h2 a.toc-backref,
div.body h3 a.toc-backref,
div.body h4 a.toc-backref,
div.body h5 a.toc-backref,
div.body h6 a.toc-backref {
color: inherit!important;
text-decoration: none;
}
a.headerlink {
color: #ddd;
padding: 0 4px;
text-decoration: none;
}
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
div.admonition {
background: #fafafa;
margin: 20px -30px;
padding: 10px 30px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
div.admonition p.admonition-title {
font-family: {{ headline_font_stack }};
font-weight: normal;
font-size: 24px;
margin: 0 0 10px 0;
padding: 0;
line-height: 1;
}
div.admonition p.last {
margin-bottom: 0;
}
div.highlight{
background-color: white;
}
dt:target, .highlight {
background: #FAF3E8;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre, tt {
font-family: {{ code_font_stack }};
font-size: 0.9em;
}
img.screenshot {
}
tt.descname, tt.descclassname {
font-size: 0.95em;
}
tt.descname {
padding-right: 0.08em;
}
img.screenshot {
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils {
border: 1px solid #888;
-moz-box-shadow: 2px 2px 4px #eee;
-webkit-box-shadow: 2px 2px 4px #eee;
box-shadow: 2px 2px 4px #eee;
}
table.docutils td, table.docutils th {
border: 1px solid #888;
padding: 0.25em 0.7em;
}
table.field-list, table.footnote {
border: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
table.footnote {
margin: 15px 0;
width: 100%;
border: 1px solid #eee;
background: #fdfdfd;
font-size: 0.9em;
}
table.footnote + table.footnote {
margin-top: -15px;
border-top: none;
}
table.field-list th {
padding: 0 0.8em 0 0;
}
table.field-list td {
padding: 0;
}
table.footnote td.label {
width: 0px;
padding: 0.3em 0 0.3em 0.5em;
}
table.footnote td {
padding: 0.3em 0.5em;
}
dl {
margin: 0;
padding: 0;
}
dl dd {
margin-left: 30px;
}
blockquote {
margin: 0 0 0 30px;
padding: 0;
}
ul {
margin: 10px 0 10px 30px;
padding: 0;
}
pre {
background: #F0FFEB;
padding: 7px 10px;
margin: 15px 0;
border: 1px solid #C7ECB8;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
line-height: 1.3em;
}
tt {
background: #F0FFEB;
color: #222;
/* padding: 1px 2px; */
}
tt.xref, a tt {
background: #F0FFEB;
border-bottom: 1px solid white;
}
a.reference {
text-decoration: none;
border-bottom: 1px dashed #DCF0D5;
}
a.reference:hover {
border-bottom: 1px solid #6D4100;
}
a.footnote-reference {
text-decoration: none;
font-size: 0.7em;
vertical-align: top;
border-bottom: 1px dashed #DCF0D5;
}
a.footnote-reference:hover {
border-bottom: 1px solid #6D4100;
}
a:hover tt {
background: #EEE;
}

View File

@ -1,5 +0,0 @@
[theme]
inherit = basic
stylesheet = celery.css
[options]

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +0,0 @@
# -*- coding: utf-8 -*-
import sys
import os
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.append(os.path.join(os.pardir, "tests"))
import kombu
from django.conf import settings
if not settings.configured:
settings.configure()
# General configuration
# ---------------------
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['.templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'Kombu'
copyright = '2009-2014, Ask Solem'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = ".".join(map(str, kombu.VERSION[0:2]))
# The full version, including alpha/beta/rc tags.
release = kombu.__version__
exclude_trees = ['.build']
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'colorful'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['.static']
html_use_smartypants = True
# If false, no module index is generated.
html_use_modindex = True
# If false, no index is generated.
html_use_index = True
latex_documents = [
('index', 'Kombu.tex', 'Kombu Documentation',
'Ask Solem', 'manual'),
]
html_theme = "celery"
html_theme_path = ["_theme"]
html_sidebars = {
'index': ['sidebarintro.html', 'sourcelink.html', 'searchbox.html'],
'**': ['sidebarlogo.html', 'localtoc.html', 'relations.html',
'sourcelink.html', 'searchbox.html'],
}

View File

@ -1,16 +0,0 @@
============================
Frequently Asked Questions
============================
Questions
=========
Q: Message.reject doesn't work?
--------------------------------------
**Answer**: Earlier versions of RabbitMQ did not implement ``basic.reject``,
so make sure your version is recent enough to support it.
Q: Message.requeue doesn't work?
--------------------------------------
**Answer**: See _`Message.reject doesn't work?`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,26 +0,0 @@
Kombu Documentation
==================================
Contents:
.. toctree::
:maxdepth: 2
introduction
userguide/index
.. toctree::
:maxdepth: 1
faq
reference/index
changelog
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,327 +0,0 @@
.. _kombu-index:
========================================
kombu - Messaging library for Python
========================================
:Version: 3.0.21
`Kombu` is a messaging library for Python.
The aim of `Kombu` is to make messaging in Python as easy as possible by
providing an idiomatic high-level interface for the AMQ protocol, and also
provide proven and tested solutions to common messaging problems.
`AMQP`_ is the Advanced Message Queuing Protocol, an open standard protocol
for message orientation, queuing, routing, reliability and security,
for which the `RabbitMQ`_ messaging server is the most popular implementation.
Features
========
* Allows application authors to support several message server
solutions by using pluggable transports.
* AMQP transport using the `py-amqp`_ or `librabbitmq`_ client libraries.
* High performance AMQP transport written in C - when using `librabbitmq`_
This is automatically enabled if librabbitmq is installed::
$ pip install librabbitmq
* Virtual transports makes it really easy to add support for non-AMQP
transports. There is already built-in support for `Redis`_,
`Beanstalk`_, `Amazon SQS`_, `CouchDB`_, `MongoDB`_, `ZeroMQ`_,
`ZooKeeper`_, `SoftLayer MQ`_ and `Pyro`_.
* You can also use the SQLAlchemy and Django ORM transports to
use a database as the broker.
* 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 errors.
* 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`_.
.. _`RabbitMQ`: http://www.rabbitmq.com/
.. _`AMQP`: http://amqp.org
.. _`py-amqp`: http://pypi.python.org/pypi/amqp/
.. _`Redis`: http://code.google.com/p/redis/
.. _`Amazon SQS`: http://aws.amazon.com/sqs/
.. _`MongoDB`: http://www.mongodb.org/
.. _`CouchDB`: http://couchdb.apache.org/
.. _`ZeroMQ`: http://zeromq.org/
.. _`Zookeeper`: https://zookeeper.apache.org/
.. _`Beanstalk`: http://kr.github.com/beanstalkd/
.. _`Rabbits and warrens`: http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/
.. _`amqplib`: http://barryp.org/software/py-amqplib/
.. _`Wikipedia article about AMQP`: http://en.wikipedia.org/wiki/AMQP
.. _`carrot`: http://pypi.python.org/pypi/carrot/
.. _`librabbitmq`: http://pypi.python.org/pypi/librabbitmq
.. _`Pyro`: http://pythonhosting.org/Pyro
.. _`SoftLayer MQ`: http://www.softlayer.com/services/additional/message-queue
.. _transport-comparison:
Transport Comparison
====================
+---------------+----------+------------+------------+---------------+
| **Client** | **Type** | **Direct** | **Topic** | **Fanout** |
+---------------+----------+------------+------------+---------------+
| *amqp* | Native | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *redis* | Virtual | Yes | Yes | Yes (PUB/SUB) |
+---------------+----------+------------+------------+---------------+
| *mongodb* | Virtual | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *beanstalk* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *SQS* | Virtual | Yes | Yes [#f1]_ | Yes [#f2]_ |
+---------------+----------+------------+------------+---------------+
| *couchdb* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *zookeeper* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *in-memory* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *django* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *sqlalchemy* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *SLMQ* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
.. [#f1] Declarations only kept in memory, so exchanges/queues
must be declared by all clients that needs them.
.. [#f2] Fanout supported via storing routing tables in SimpleDB.
Disabled by default, but can be enabled by using the
``supports_fanout`` transport option.
Documentation
-------------
Kombu is using Sphinx, and the latest documentation can be found here:
http://kombu.readthedocs.org/
Quick overview
--------------
::
from kombu import Connection, Exchange, Queue
media_exchange = Exchange('media', 'direct', durable=True)
video_queue = Queue('video', exchange=media_exchange, routing_key='video')
def process_media(body, message):
print body
message.ack()
# connections
with Connection('amqp://guest:guest@localhost//') as conn:
# produce
producer = conn.Producer(serializer='json')
producer.publish({'name': '/tmp/lolcat1.avi', 'size': 1301013},
exchange=media_exchange, routing_key='video',
declare=[video_queue])
# the declare above, makes sure the video queue is declared
# so that the messages can be delivered.
# It's a best practice in Kombu to have both publishers and
# consumers declare the queue. You can also declare the
# queue manually using:
# video_queue(conn).declare()
# consume
with conn.Consumer(video_queue, callbacks=[process_media]) as consumer:
# Process messages and handle events on all channels
while True:
conn.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')
with connection.Consumer([video_queue, image_queue],
callbacks=[process_media]) as consumer:
while True:
connection.drain_events()
Or handle channels manually::
with connection.channel() as channel:
producer = Producer(channel, ...)
consumer = Producer(channel)
All objects can be used outside of with statements too,
just remember to close the objects after use::
from kombu import Connection, Consumer, Producer
connection = Connection()
# ...
connection.release()
consumer = Consumer(channel_or_connection, ...)
consumer.register_callback(my_callback)
consumer.consume()
# ....
consumer.cancel()
`Exchange` and `Queue` are simply declarations that can be pickled
and used in configuration files etc.
They also support operations, but to do so they need to be bound
to a channel.
Binding exchanges and queues to a connection will make it use
that connections default channel.
::
>>> exchange = Exchange('tasks', 'direct')
>>> connection = Connection()
>>> bound_exchange = exchange(connection)
>>> 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.
.. _`carrot-users`: http://groups.google.com/group/carrot-users/
Bug tracker
===========
If you have any suggestions, bug reports or annoyances please report them
to our issue tracker at http://github.com/celery/kombu/issues/
Contributing
============
Development of `Kombu` happens at Github: http://github.com/celery/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.
.. image:: https://d2weczhvl823v0.cloudfront.net/celery/kombu/trend.png
:alt: Bitdeli badge
:target: https://bitdeli.com/free

View File

@ -1,67 +0,0 @@
===========================
API Reference
===========================
:Release: |version|
:Date: |today|
.. toctree::
:maxdepth: 2
kombu
kombu.common
kombu.mixins
kombu.simple
kombu.clocks
kombu.compat
kombu.pidbox
kombu.exceptions
kombu.log
kombu.connection
kombu.message
kombu.compression
kombu.pools
kombu.abstract
kombu.syn
kombu.async
kombu.async.hub
kombu.async.semaphore
kombu.async.timer
kombu.async.debug
kombu.transport
kombu.transport.pyamqp
kombu.transport.librabbitmq
kombu.transport.memory
kombu.transport.redis
kombu.transport.zmq
kombu.transport.beanstalk
kombu.transport.mongodb
kombu.transport.couchdb
kombu.transport.zookeeper
kombu.transport.filesystem
kombu.transport.django
kombu.transport.django.models
kombu.transport.django.managers
kombu.transport.django.management.commands.clean_kombu_messages
kombu.transport.sqlalchemy
kombu.transport.sqlalchemy.models
kombu.transport.SQS
kombu.transport.SLMQ
kombu.transport.pyro
kombu.transport.amqplib
kombu.transport.base
kombu.transport.virtual
kombu.transport.virtual.exchange
kombu.transport.virtual.scheduling
kombu.serialization
kombu.utils
kombu.utils.eventio
kombu.utils.limits
kombu.utils.compat
kombu.utils.debug
kombu.utils.encoding
kombu.utils.functional
kombu.utils.url
kombu.utils.text
kombu.utils.amq_manager
kombu.five

View File

@ -1,10 +0,0 @@
.. currentmodule:: kombu.abstract
.. automodule:: kombu.abstract
.. contents::
:local:
.. autoclass:: MaybeChannelBound
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Debugging Utils - kombu.async.debug
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.async.debug
.. automodule:: kombu.async.debug
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Event Loop Implementation - kombu.async.hub
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.async.hub
.. automodule:: kombu.async.hub
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Event Loop - kombu.async
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.async
.. automodule:: kombu.async
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Semaphores - kombu.async.semaphore
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.async.semaphore
.. automodule:: kombu.async.semaphore
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Timer - kombu.async.timer
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.async.timer
.. automodule:: kombu.async.timer
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Clocks and Synchronization - kombu.clocks
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.clocks
.. automodule:: kombu.clocks
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Common Utilities - kombu.common
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.common
.. automodule:: kombu.common
:members:
:undoc-members:

View File

@ -1,36 +0,0 @@
.. currentmodule:: kombu.compat
.. automodule:: kombu.compat
.. contents::
:local:
Publisher
---------
Replace with :class:`kombu.Producer`.
.. autoclass:: Publisher
:members:
:undoc-members:
:inherited-members:
Consumer
--------
Replace with :class:`kombu.Consumer`.
.. autoclass:: Consumer
:members:
:undoc-members:
:inherited-members:
ConsumerSet
-----------
Replace with :class:`kombu.Consumer`.
.. autoclass:: ConsumerSet
:members:
:undoc-members:
:inherited-members:

View File

@ -1,20 +0,0 @@
.. currentmodule:: kombu.compression
.. automodule:: kombu.compression
.. contents::
:local:
Encoding/decoding
-----------------
.. autofunction:: compress
.. autofunction:: decompress
Registry
--------
.. autofunction:: encoders
.. autofunction:: get_encoder
.. autofunction:: get_decoder
.. autofunction:: register

View File

@ -1,40 +0,0 @@
.. currentmodule:: kombu.connection
.. automodule:: kombu.connection
.. contents::
:local:
Connection
----------
.. autoclass:: Connection
:members:
:undoc-members:
Pools
-----
.. seealso::
The shortcut methods :meth:`Connection.Pool` and
:meth:`Connection.ChannelPool` is the recommended way
to instantiate these classes.
.. autoclass:: ConnectionPool
.. autoattribute:: LimitExceeded
.. automethod:: acquire
.. automethod:: release
.. automethod:: force_close_all
.. autoclass:: ChannelPool
.. autoattribute:: LimitExceeded
.. automethod:: acquire
.. automethod:: release
.. automethod:: force_close_all

View File

@ -1,14 +0,0 @@
.. currentmodule:: kombu.exceptions
.. automodule:: kombu.exceptions
.. contents::
:local:
.. autoexception:: NotBoundError
.. autoexception:: MessageStateError
.. autoexception:: TimeoutError
.. autoexception:: LimitExceeded
.. autoexception:: ConnectionLimitExceeded
.. autoexception:: ChannelLimitExceeded

View File

@ -1,11 +0,0 @@
==========================================================
Python2 to Python3 utilities - kombu.five
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.five
.. automodule:: kombu.five
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Logging - kombu.log
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.log
.. automodule:: kombu.log
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Message Objects - kombu.message
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.message
.. automodule:: kombu.message
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Mixin Classes - kombu.mixins
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.mixins
.. automodule:: kombu.mixins
:members:
:undoc-members:

View File

@ -1,89 +0,0 @@
.. currentmodule:: kombu.pidbox
.. automodule:: kombu.pidbox
.. contents::
:local:
Introduction
------------
Creating the applications Mailbox
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
>>> mailbox = pidbox.Mailbox("celerybeat", type="direct")
>>> @mailbox.handler
>>> def reload_schedule(state, **kwargs):
... state["beat"].reload_schedule()
>>> @mailbox.handler
>>> def connection_info(state, **kwargs):
... return {"connection": state["connection"].info()}
Example Node
~~~~~~~~~~~~
.. code-block:: python
>>> connection = kombu.Connection()
>>> state = {"beat": beat,
"connection": connection}
>>> consumer = mailbox(connection).Node(hostname).listen()
>>> try:
... while True:
... connection.drain_events(timeout=1)
... finally:
... consumer.cancel()
Example Client
~~~~~~~~~~~~~~
.. code-block:: python
>>> mailbox.cast("reload_schedule") # cast is async.
>>> info = celerybeat.call("connection_info", timeout=1)
Mailbox
-------
.. autoclass:: Mailbox
.. autoattribute:: namespace
.. autoattribute:: connection
.. autoattribute:: type
.. autoattribute:: exchange
.. autoattribute:: reply_exchange
.. automethod:: Node
.. automethod:: call
.. automethod:: cast
.. automethod:: abcast
.. automethod:: multi_call
.. automethod:: get_reply_queue
.. automethod:: get_queue
Node
----
.. autoclass:: Node
.. autoattribute:: hostname
.. autoattribute:: mailbox
.. autoattribute:: handlers
.. autoattribute:: state
.. autoattribute:: channel
.. automethod:: Consumer
.. automethod:: handler
.. automethod:: listen
.. automethod:: dispatch
.. automethod:: dispatch_from_message
.. automethod:: handle_call
.. automethod:: handle_cast
.. automethod:: handle
.. automethod:: handle_message
.. automethod:: reply

View File

@ -1,11 +0,0 @@
==========================================================
General Pools - kombu.pools
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.pools
.. automodule:: kombu.pools
:members:
:undoc-members:

View File

@ -1,187 +0,0 @@
.. currentmodule:: kombu
.. contents::
:local:
.. automodule:: kombu
.. autofunction:: enable_insecure_serializers
.. autofunction:: disable_insecure_serializers
Connection
----------
.. autoclass:: Connection
.. admonition:: Attributes
.. autoattribute:: hostname
.. autoattribute:: port
.. autoattribute:: userid
.. autoattribute:: password
.. autoattribute:: virtual_host
.. autoattribute:: ssl
.. autoattribute:: login_method
.. autoattribute:: failover_strategy
.. autoattribute:: connect_timeout
.. autoattribute:: heartbeat
.. autoattribute:: default_channel
.. autoattribute:: connected
.. autoattribute:: recoverable_connection_errors
.. autoattribute:: recoverable_channel_errors
.. autoattribute:: connection_errors
.. autoattribute:: channel_errors
.. autoattribute:: transport
.. autoattribute:: connection
.. autoattribute:: uri_prefix
.. autoattribute:: declared_entities
.. autoattribute:: cycle
.. autoattribute:: host
.. autoattribute:: manager
.. autoattribute:: supports_heartbeats
.. autoattribute:: is_evented
.. admonition:: Methods
.. automethod:: as_uri
.. automethod:: connect
.. automethod:: channel
.. automethod:: drain_events
.. automethod:: release
.. automethod:: autoretry
.. automethod:: ensure_connection
.. automethod:: ensure
.. automethod:: revive
.. automethod:: create_transport
.. automethod:: get_transport_cls
.. automethod:: clone
.. automethod:: info
.. automethod:: switch
.. automethod:: maybe_switch_next
.. automethod:: heartbeat_check
.. automethod:: maybe_close_channel
.. automethod:: register_with_event_loop
.. automethod:: close
.. automethod:: _close
.. automethod:: completes_cycle
.. automethod:: get_manager
.. automethod:: Producer
.. automethod:: Consumer
.. automethod:: Pool
.. automethod:: ChannelPool
.. automethod:: SimpleQueue
.. automethod:: SimpleBuffer
Exchange
--------
Example creating an exchange declaration::
>>> news_exchange = Exchange('news', type='topic')
For now `news_exchange` is just a declaration, you can't perform
actions on it. It just describes the name and options for the exchange.
The exchange can be bound or unbound. Bound means the exchange is
associated with a channel and operations can be performed on it.
To bind the exchange you call the exchange with the channel as argument::
>>> bound_exchange = news_exchange(channel)
Now you can perform operations like :meth:`declare` or :meth:`delete`::
>>> bound_exchange.declare()
>>> message = bound_exchange.Message('Cure for cancer found!')
>>> bound_exchange.publish(message, routing_key='news.science')
>>> bound_exchange.delete()
.. autoclass:: Exchange
:members:
:undoc-members:
.. automethod:: maybe_bind
Queue
-----
Example creating a queue using our exchange in the :class:`Exchange`
example::
>>> science_news = Queue('science_news',
... exchange=news_exchange,
... routing_key='news.science')
For now `science_news` is just a declaration, you can't perform
actions on it. It just describes the name and options for the queue.
The queue can be bound or unbound. Bound means the queue is
associated with a channel and operations can be performed on it.
To bind the queue you call the queue instance with the channel as
an argument::
>>> bound_science_news = science_news(channel)
Now you can perform operations like :meth:`declare` or :meth:`purge`:
.. code-block:: python
>>> bound_science_news.declare()
>>> bound_science_news.purge()
>>> bound_science_news.delete()
.. autoclass:: Queue
:members:
:undoc-members:
.. automethod:: maybe_bind
Message Producer
----------------
.. autoclass:: Producer
.. autoattribute:: channel
.. autoattribute:: exchange
.. autoattribute:: routing_key
.. autoattribute:: serializer
.. autoattribute:: compression
.. autoattribute:: auto_declare
.. autoattribute:: on_return
.. autoattribute:: connection
.. automethod:: declare
.. automethod:: maybe_declare
.. automethod:: publish
.. automethod:: revive
Message Consumer
----------------
.. autoclass:: Consumer
.. autoattribute:: channel
.. autoattribute:: queues
.. autoattribute:: no_ack
.. autoattribute:: auto_declare
.. autoattribute:: callbacks
.. autoattribute:: on_message
.. autoattribute:: on_decode_error
.. autoattribute:: connection
.. automethod:: declare
.. automethod:: register_callback
.. automethod:: add_queue
.. automethod:: add_queue_from_dict
.. automethod:: consume
.. automethod:: cancel
.. automethod:: cancel_by_queue
.. automethod:: consuming_from
.. automethod:: purge
.. automethod:: flow
.. automethod:: qos
.. automethod:: recover
.. automethod:: receive
.. automethod:: revive

View File

@ -1,47 +0,0 @@
.. currentmodule:: kombu.serialization
.. automodule:: kombu.serialization
.. contents::
:local:
Overview
--------
Centralized support for encoding/decoding of data structures.
Contains json, pickle, msgpack, and yaml serializers.
Optionally installs support for YAML if the `PyYAML`_ package
is installed.
Optionally installs support for `msgpack`_ if the `msgpack-python`_
package is installed.
Exceptions
----------
.. autoexception:: SerializerNotInstalled
Serialization
-------------
.. autofunction:: encode
.. autofunction:: decode
.. autofunction:: raw_encode
Registry
--------
.. autofunction:: register
.. autodata:: registry
.. _`cjson`: http://pypi.python.org/pypi/python-cjson/
.. _`simplejson`: http://code.google.com/p/simplejson/
.. _`Python 2.6+`: http://docs.python.org/library/json.html
.. _`PyYAML`: http://pyyaml.org/
.. _`msgpack`: http://msgpack.sourceforge.net/
.. _`msgpack-python`: http://pypi.python.org/pypi/msgpack-python/

View File

@ -1,89 +0,0 @@
.. currentmodule:: kombu.simple
.. automodule:: kombu.simple
.. contents::
:local:
Persistent
----------
.. autoclass:: SimpleQueue
.. attribute:: channel
Current channel
.. attribute:: producer
:class:`~kombu.Producer` used to publish messages.
.. attribute:: consumer
:class:`~kombu.Consumer` used to receive messages.
.. attribute:: no_ack
flag to enable/disable acknowledgements.
.. attribute:: queue
:class:`~kombu.Queue` to consume from (if consuming).
.. attribute:: queue_opts
Additional options for the queue declaration.
.. attribute:: exchange_opts
Additional options for the exchange declaration.
.. automethod:: get
.. automethod:: get_nowait
.. automethod:: put
.. automethod:: clear
.. automethod:: __len__
.. automethod:: qsize
.. automethod:: close
Buffer
------
.. autoclass:: SimpleBuffer
.. attribute:: channel
Current channel
.. attribute:: producer
:class:`~kombu.Producer` used to publish messages.
.. attribute:: consumer
:class:`~kombu.Consumer` used to receive messages.
.. attribute:: no_ack
flag to enable/disable acknowledgements.
.. attribute:: queue
:class:`~kombu.Queue` to consume from (if consuming).
.. attribute:: queue_opts
Additional options for the queue declaration.
.. attribute:: exchange_opts
Additional options for the exchange declaration.
.. automethod:: get
.. automethod:: get_nowait
.. automethod:: put
.. automethod:: clear
.. automethod:: __len__
.. automethod:: qsize
.. automethod:: close

View File

@ -1,11 +0,0 @@
==========================================================
Async Utilities - kombu.syn
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.syn
.. automodule:: kombu.syn
.. autofunction:: detect_environment

View File

@ -1,24 +0,0 @@
======================================
kombu.transport.SLMQ
======================================
.. currentmodule:: kombu.transport.SLMQ
.. automodule:: kombu.transport.SLMQ
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,20 +0,0 @@
.. currentmodule:: kombu.transport.SQS
.. automodule:: kombu.transport.SQS
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,36 +0,0 @@
.. currentmodule:: kombu.transport.amqplib
.. automodule:: kombu.transport.amqplib
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Connection
----------
.. autoclass:: Connection
:members:
:undoc-members:
:inherited-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:
Message
-------
.. autoclass:: Message
:members:
:undoc-members:

View File

@ -1,62 +0,0 @@
.. currentmodule:: kombu.transport.base
.. automodule:: kombu.transport.base
.. contents::
:local:
Message
-------
.. autoclass:: Message
.. autoattribute:: payload
.. autoattribute:: channel
.. autoattribute:: delivery_tag
.. autoattribute:: content_type
.. autoattribute:: content_encoding
.. autoattribute:: delivery_info
.. autoattribute:: headers
.. autoattribute:: properties
.. autoattribute:: body
.. autoattribute:: acknowledged
.. automethod:: ack
.. automethod:: reject
.. automethod:: requeue
.. automethod:: decode
Transport
---------
.. autoclass:: Transport
.. autoattribute:: client
.. autoattribute:: default_port
.. attribute:: recoverable_connection_errors
Optional list of connection related exceptions that can be
recovered from, but where the connection must be closed
and re-established first.
If not defined then all :attr:`connection_errors` and
:class:`channel_errors` will be regarded as recoverable,
but needing to close the connection first.
.. attribute:: recoverable_channel_errors
Optional list of channel related exceptions that can be
automatically recovered from without re-establishing the
connection.
.. autoattribute:: connection_errors
.. autoattribute:: channel_errors
.. automethod:: establish_connection
.. automethod:: close_connection
.. automethod:: create_channel
.. automethod:: close_channel
.. automethod:: drain_events

View File

@ -1,20 +0,0 @@
.. currentmodule:: kombu.transport.beanstalk
.. automodule:: kombu.transport.beanstalk
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,25 +0,0 @@
.. currentmodule:: kombu.transport.couchdb
.. automodule:: kombu.transport.couchdb
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:
Functions
---------
.. autofunction:: create_message_view

View File

@ -1,14 +0,0 @@
==========================================================
Django Management - clean_kombu_messages
==========================================================
.. contents::
:local:
.. currentmodule::
kombu.transport.django.management.commands.clean_kombu_messages
.. automodule::
kombu.transport.django.management.commands.clean_kombu_messages
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Django Managers - kombu.transport.django.managers
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.transport.django.managers
.. automodule:: kombu.transport.django.managers
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Django Models - kombu.transport.django.models
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.transport.django.models
.. automodule:: kombu.transport.django.models
:members:
:undoc-members:

View File

@ -1,24 +0,0 @@
=========================================
kombu.transport.django
=========================================
.. currentmodule:: kombu.transport.django
.. automodule:: kombu.transport.django
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,21 +0,0 @@
.. currentmodule:: kombu.transport.filesystem
.. automodule:: kombu.transport.filesystem
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,35 +0,0 @@
.. currentmodule:: kombu.transport.librabbitmq
.. automodule:: kombu.transport.librabbitmq
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Connection
----------
.. autoclass:: Connection
:members:
:undoc-members:
:inherited-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:
Message
-------
.. autoclass:: Message
:members:
:undoc-members:

View File

@ -1,20 +0,0 @@
.. currentmodule:: kombu.transport.memory
.. automodule:: kombu.transport.memory
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,20 +0,0 @@
.. currentmodule:: kombu.transport.mongodb
.. automodule:: kombu.transport.mongodb
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,36 +0,0 @@
.. currentmodule:: kombu.transport.pyamqp
.. automodule:: kombu.transport.pyamqp
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Connection
----------
.. autoclass:: Connection
:members:
:undoc-members:
:inherited-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:
Message
-------
.. autoclass:: Message
:members:
:undoc-members:

View File

@ -1,20 +0,0 @@
.. currentmodule:: kombu.transport.pyro
.. automodule:: kombu.transport.pyro
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,20 +0,0 @@
.. currentmodule:: kombu.transport.redis
.. automodule:: kombu.transport.redis
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,23 +0,0 @@
.. currentmodule:: kombu.transport
.. automodule:: kombu.transport
.. contents::
:local:
Data
----
.. data:: DEFAULT_TRANSPORT
Default transport used when no transport specified.
.. data:: TRANSPORT_ALIASES
Mapping of transport aliases/class names.
Functions
---------
.. autofunction:: get_transport_cls
.. autofunction:: resolve_transport

View File

@ -1,27 +0,0 @@
.. currentmodule:: kombu.transport.sqlalchemy.models
.. automodule:: kombu.transport.sqlalchemy.models
.. contents::
:local:
Models
------
.. autoclass:: Queue
.. autoattribute:: Queue.id
.. autoattribute:: Queue.name
.. autoclass:: Message
.. autoattribute:: Message.id
.. autoattribute:: Message.visible
.. autoattribute:: Message.sent_at
.. autoattribute:: Message.payload
.. autoattribute:: Message.version

View File

@ -1,25 +0,0 @@
====================================
kombu.transport.sqlalchemy
====================================
.. currentmodule:: kombu.transport.sqlalchemy
.. automodule:: kombu.transport.sqlalchemy
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,35 +0,0 @@
.. currentmodule:: kombu.transport.virtual.exchange
.. automodule:: kombu.transport.virtual.exchange
.. contents::
:local:
Direct
------
.. autoclass:: DirectExchange
:members:
:undoc-members:
Topic
-----
.. autoclass:: TopicExchange
:members:
:undoc-members:
Fanout
------
.. autoclass:: FanoutExchange
:members:
:undoc-members:
Interface
---------
.. autoclass:: ExchangeType
:members:
:undoc-members:

View File

@ -1,117 +0,0 @@
.. currentmodule:: kombu.transport.virtual
.. automodule:: kombu.transport.virtual
.. contents::
:local:
Transports
----------
.. autoclass:: Transport
.. autoattribute:: Channel
.. autoattribute:: Cycle
.. autoattribute:: polling_interval
.. autoattribute:: default_port
.. autoattribute:: state
.. autoattribute:: cycle
.. automethod:: establish_connection
.. automethod:: close_connection
.. automethod:: create_channel
.. automethod:: close_channel
.. automethod:: drain_events
Channel
-------
.. autoclass:: AbstractChannel
:members:
.. autoclass:: Channel
.. autoattribute:: Message
.. autoattribute:: state
.. autoattribute:: qos
.. autoattribute:: do_restore
.. autoattribute:: exchange_types
.. automethod:: exchange_declare
.. automethod:: exchange_delete
.. automethod:: queue_declare
.. automethod:: queue_delete
.. automethod:: queue_bind
.. automethod:: queue_purge
.. automethod:: basic_publish
.. automethod:: basic_consume
.. automethod:: basic_cancel
.. automethod:: basic_get
.. automethod:: basic_ack
.. automethod:: basic_recover
.. automethod:: basic_reject
.. automethod:: basic_qos
.. automethod:: get_table
.. automethod:: typeof
.. automethod:: drain_events
.. automethod:: prepare_message
.. automethod:: message_to_python
.. automethod:: flow
.. automethod:: close
Message
-------
.. autoclass:: Message
:members:
:undoc-members:
:inherited-members:
Quality Of Service
------------------
.. autoclass:: QoS
:members:
:undoc-members:
:inherited-members:
In-memory State
---------------
.. autoclass:: BrokerState
:members:
:undoc-members:
:inherited-members:

View File

@ -1,7 +0,0 @@
.. contents::
:local:
.. currentmodule:: kombu.transport.virtual.scheduling
.. automodule:: kombu.transport.virtual.scheduling
:members:
:undoc-members:

View File

@ -1,13 +0,0 @@
=====================
kombu.transport.zmq
=====================
.. currentmodule:: kombu.transport.zmq
.. automodule:: kombu.transport.zmq
.. contents::
:local:
:members:
:undoc-members:

View File

@ -1,25 +0,0 @@
===========================
kombu.transport.zookeeper
===========================
.. currentmodule:: kombu.transport.zookeeper
.. automodule:: kombu.transport.zookeeper
.. contents::
:local:
Transport
---------
.. autoclass:: Transport
:members:
:undoc-members:
Channel
-------
.. autoclass:: Channel
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
====================================================
Generic RabbitMQ manager - kombu.utils.amq_manager
====================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.amq_manager
.. automodule:: kombu.utils.amq_manager
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Compat. utilities - kombu.utils.compat
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.compat
.. automodule:: kombu.utils.compat
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Debugging - kombu.utils.debug
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.debug
.. automodule:: kombu.utils.debug
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
String Encoding - kombu.utils.encoding
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.encoding
.. automodule:: kombu.utils.encoding
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Evented I/O - kombu.utils.eventio
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.eventio
.. automodule:: kombu.utils.eventio
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
kombu.utils.functional
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.functional
.. automodule:: kombu.utils.functional
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Rate limiting - kombu.utils.limits
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.limits
.. automodule:: kombu.utils.limits
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Utilities - kombu.utils
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils
.. automodule:: kombu.utils
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==========================================================
Text utilitites - kombu.utils.text
==========================================================
.. contents::
:local:
.. currentmodule:: kombu.utils.text
.. automodule:: kombu.utils.text
:members:
:undoc-members:

View File

@ -1,11 +0,0 @@
==============================================
kombu.utils.url
==============================================
.. contents::
:local:
.. currentmodule:: kombu.utils.url
.. automodule:: kombu.utils.url
:members:
:undoc-members:

View File

@ -1,178 +0,0 @@
.. _guide-connections:
============================
Connections and transports
============================
.. _connection-basics:
Basics
======
To send and receive messages you need a transport and a connection.
There are several transports to choose from (amqp, librabbitmq, redis, in-memory, etc.),
and you can even create your own. The default transport is amqp.
Create a connection using the default transport::
>>> from kombu import Connection
>>> connection = Connection('amqp://guest:guest@localhost:5672//')
The connection will not be established yet, as the connection is established
when needed. If you want to explicitly establish the connection
you have to call the :meth:`~kombu.Connection.connect`
method::
>>> connection.connect()
You can also check whether the connection is connected::
>>> connection.connected
True
Connections must always be closed after use::
>>> connection.close()
But best practice is to release the connection instead,
this will release the resource if the connection is associated
with a connection pool, or close the connection if not,
and makes it easier to do the transition to connection pools later::
>>> connection.release()
.. seealso::
:ref:`guide-pools`
Of course, the connection can be used as a context, and you are
encouraged to do so as it makes it harder to forget releasing open
resources::
with Connection() as connection:
# work with connection
.. _connection-urls:
URLs
====
Connection parameters can be provided as an URL in the format::
transport://userid:password@hostname:port/virtual_host
All of these are valid URLs::
# Specifies using the amqp transport only, default values
# are taken from the keyword arguments.
amqp://
# Using Redis
redis://localhost:6379/
# Using Redis over a Unix socket
redis+socket:///tmp/redis.sock
# Using virtual host '/foo'
amqp://localhost//foo
# Using virtual host 'foo'
amqp://localhost/foo
The query part of the URL can also be used to set options, e.g.::
amqp://localhost/myvhost?ssl=1
See :ref:`connection-options` for a list of supported options.
A connection without options will use the default connection settings,
which is using the localhost host, default port, user name `guest`,
password `guest` and virtual host "/". A connection without arguments
is the same as::
>>> Connection('amqp://guest:guest@localhost:5672//')
The default port is transport specific, for AMQP this is 5672.
Other fields may also have different meaning depending on the transport
used. For example, the Redis transport uses the `virtual_host` argument as
the redis database number.
.. _connection-options:
Keyword arguments
=================
The :class:`~kombu.Connection` class supports additional
keyword arguments, these are:
:hostname: Default host name if not provided in the URL.
:userid: Default user name if not provided in the URL.
:password: Default password if not provided in the URL.
:virtual_host: Default virtual host if not provided in the URL.
:port: Default port if not provided in the URL.
:transport: Default transport if not provided in the URL.
Can be a string specifying the path to the class. (e.g.
``kombu.transport.pyamqp:Transport``), or one of the aliases:
``pyamqp``, ``librabbitmq``, ``redis``, ``memory``, and so on.
:ssl: Use SSL to connect to the server. Default is ``False``.
Only supported by the amqp transport.
:insist: Insist on connecting to a server.
*No longer supported, relic from AMQP 0.8*
:connect_timeout: Timeout in seconds for connecting to the
server. May not be supported by the specified transport.
:transport_options: A dict of additional connection arguments to
pass to alternate kombu channel implementations. Consult the transport
documentation for available options.
AMQP Transports
===============
There are 3 transports available for AMQP use.
1. ``pyamqp`` uses the pure Python library ``amqp``, automatically
installed with Kombu.
2. ``librabbitmq`` uses the high performance transport written in C.
This requires the ``librabbitmq`` Python package to be installed, which
automatically compiles the C library.
3. ``amqp`` tries to use ``librabbitmq`` but falls back to ``pyamqp``.
For the highest performance, you should install the ``librabbitmq`` package.
To ensure librabbitmq is used, you can explicitly specify it in the
transport URL, or use ``amqp`` to have the fallback.
Transport Comparison
====================
+---------------+----------+------------+------------+---------------+
| **Client** | **Type** | **Direct** | **Topic** | **Fanout** |
+---------------+----------+------------+------------+---------------+
| *amqp* | Native | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *redis* | Virtual | Yes | Yes | Yes (PUB/SUB) |
+---------------+----------+------------+------------+---------------+
| *mongodb* | Virtual | Yes | Yes | Yes |
+---------------+----------+------------+------------+---------------+
| *beanstalk* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *SQS* | Virtual | Yes | Yes [#f1]_ | Yes [#f2]_ |
+---------------+----------+------------+------------+---------------+
| *couchdb* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *zookeeper* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *in-memory* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *django* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
| *sqlalchemy* | Virtual | Yes | Yes [#f1]_ | No |
+---------------+----------+------------+------------+---------------+
.. [#f1] Declarations only kept in memory, so exchanges/queues
must be declared by all clients that needs them.
.. [#f2] Fanout supported via storing routing tables in SimpleDB.
Disabled by default, but can be enabled by using the
``supports_fanout`` transport option.

View File

@ -1,103 +0,0 @@
.. _guide-consumers:
===========
Consumers
===========
.. _consumer-basics:
Basics
======
The :class:`Consumer` takes a connection (or channel) and a list of queues to
consume from. Several consumers can be mixed to consume from different
channels, as they all bind to the same connection, and ``drain_events`` will
drain events from all channels on that connection.
.. note::
Kombu since 3.0 will only accept json/binary or text messages by default,
to allow deserialization of other formats you have to specify them
in the ``accept`` argument::
Consumer(conn, accept=['json', 'pickle', 'msgpack', 'yaml'])
Draining events from a single consumer:
.. code-block:: python
with Consumer(connection, queues, accept=['json']):
connection.drain_events(timeout=1)
Draining events from several consumers:
.. code-block:: python
from kombu.utils import nested
with connection.channel(), connection.channel() as (channel1, channel2):
with nested(Consumer(channel1, queues1, accept=['json']),
Consumer(channel2, queues2, accept=['json'])):
connection.drain_events(timeout=1)
Or using :class:`~kombu.mixins.ConsumerMixin`:
.. code-block:: python
from kombu.mixins import ConsumerMixin
class C(ConsumerMixin):
def __init__(self, connection):
self.connection = connection
def get_consumers(self, Consumer, channel):
return [
Consumer(queues, callbacks=[self.on_message], accept=['json']),
]
def on_message(self, body, message):
print("RECEIVED MESSAGE: %r" % (body, ))
message.ack()
C(connection).run()
and with multiple channels again:
.. code-block:: python
from kombu import Consumer
from kombu.mixins import ConsumerMixin
class C(ConsumerMixin):
channel2 = None
def __init__(self, connection):
self.connection = connection
def get_consumers(self, _, default_channel):
self.channel2 = default_channel.connection.channel()
return [Consumer(default_channel, queues1,
callbacks=[self.on_message],
accept=['json']),
Consumer(self.channel2, queues2,
callbacks=[self.on_special_message],
accept=['json'])]
def on_consumer_end(self, connection, default_channel):
if self.channel2:
self.channel2.close()
C(connection).run()
Reference
=========
.. autoclass:: kombu.Consumer
:noindex:
:members:

View File

@ -1,57 +0,0 @@
.. _examples:
========================
Examples
========================
.. _hello-world-example:
Hello World Example
===================
Below example uses
:ref:`guide-simple`
to send helloworld message through
message broker (rabbitmq) and print received message
:file:`hello_publisher.py`:
.. literalinclude:: ../../examples/hello_publisher.py
:language: python
:file:`hello_consumer.py`:
.. literalinclude:: ../../examples/hello_consumer.py
:language: python
.. _task-queue-example:
Task Queue Example
==================
Very simple task queue using pickle, with primitive support
for priorities using different queues.
:file:`queues.py`:
.. literalinclude:: ../../examples/simple_task_queue/queues.py
:language: python
:file:`worker.py`:
.. literalinclude:: ../../examples/simple_task_queue/worker.py
:language: python
:file:`tasks.py`:
.. literalinclude:: ../../examples/simple_task_queue/tasks.py
:language: python
.. code-block:: python
:file:`client.py`:
.. literalinclude:: ../../examples/simple_task_queue/client.py

Some files were not shown because too many files have changed in this diff Show More