From 7b706c40abd8ef128e938acfdbf7b36d8838f1a3 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Fri, 3 Feb 2012 15:29:17 +0000 Subject: [PATCH] Updates Changelog --- Changelog | 19 +++++++++++++++++++ kombu/common.py | 30 ++++++++++++++++++++++++++++++ kombu/transport/__init__.py | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index e23bd0fc..b2bd3f11 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,25 @@ Change history ================ +.. _version-2.1.0: + +2.1.0 +===== +:release-date: 2012-02-03 17:00 P.M GMT +:by: Ask Solem + +* MongoDB: Now supports fanout (broadcast) (Issue #98). + + Contributed by Scott Lyons + +* pika transport: Now works with pika 0.9.5 and 0.9.6dev. + + The old pika transport (supporting 0.5.x) is now available + as alias ``oldpika``. + + (Note terribly latency has been experienced with the new pika + versions, so this is still an experimental transport). + .. _version-2.0.0: 2.0.0 diff --git a/kombu/common.py b/kombu/common.py index 1fad8f8b..f16c3883 100644 --- a/kombu/common.py +++ b/kombu/common.py @@ -96,6 +96,36 @@ def itermessages(conn, channel, queue, limit=1, timeout=None, def eventloop(conn, limit=None, timeout=None, ignore_timeouts=False): + """Best practice generator wrapper around ``Connection.drain_events``. + + Able to drain events forever, with a limit, and optionally ignoring + timeout errors (a timeout of 1 is often used in environments where + the socket can get "stuck", and is a best practice for Kombu consumers). + + **Examples** + + ``eventloop`` is a generator:: + + >>> from kombu.common import eventloop + + >>> it = eventloop(connection, timeout=1, ignore_timeouts=True) + >>> it.next() # one event consumed, or timed out. + + >>> for _ in eventloop(connection, timeout=1, ignore_timeouts=True): + ... pass # loop forever. + + It also takes an optional limit parameter, and timeout errors + are propagated by default:: + + for _ in eventloop(connection, limit=1, timeout=1): + pass + + .. seealso:: + + :func:`itermessages`, which is an event loop bound to one or more + consumers, that yields any messages received. + + """ for i in limit and xrange(limit) or count(): try: yield conn.drain_events(timeout=timeout) diff --git a/kombu/transport/__init__.py b/kombu/transport/__init__.py index 8414f329..f6f5f198 100644 --- a/kombu/transport/__init__.py +++ b/kombu/transport/__init__.py @@ -40,7 +40,7 @@ TRANSPORT_ALIASES = { "amqplib": "kombu.transport.amqplib.Transport", "librabbitmq": "kombu.transport.librabbitmq.Transport", "pika": "kombu.transport.pika2.Transport", - "syncpika": "kombu.transport.pika.SyncTransport", + "oldpika": "kombu.transport.pika.SyncTransport", "memory": "kombu.transport.memory.Transport", "redis": "kombu.transport.redis.Transport", "SQS": "kombu.transport.SQS.Transport",