summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorStefan Eletzhofer <se@nexiles.de>2011-10-18 12:36:14 +0200
committerAsk Solem <ask@celeryproject.org>2011-10-25 22:12:47 +0100
commite26976d1dd2c386bf06ce5e5affa7b6e79f55711 (patch)
tree4c62011d3bb8b851601441d503a0f960db509268 /examples
parent5b0667256f4e560dbd63b78151dff3c3632e0000 (diff)
downloadkombu-e26976d1dd2c386bf06ce5e5affa7b6e79f55711.tar.gz
Fixes to get the simple_task_queue example running. Closes #72
Diffstat (limited to 'examples')
-rw-r--r--examples/simple_task_queue/client.py6
-rw-r--r--examples/simple_task_queue/worker.py11
2 files changed, 10 insertions, 7 deletions
diff --git a/examples/simple_task_queue/client.py b/examples/simple_task_queue/client.py
index edf63f76..a2f89942 100644
--- a/examples/simple_task_queue/client.py
+++ b/examples/simple_task_queue/client.py
@@ -3,7 +3,7 @@ from __future__ import with_statement
from kombu.common import maybe_declare
from kombu.pools import producers
-from .queues import task_exchange
+from queues import task_exchange
priority_to_routing_key = {"high": "hipri",
"mid": "midpri",
@@ -22,8 +22,8 @@ def send_as_task(connection, fun, args, kwargs, priority="mid"):
if __name__ == "__main__":
from kombu import BrokerConnection
- from .tasks import hello_task
+ from tasks import hello_task
connection = BrokerConnection("amqp://guest:guest@localhost:5672//")
- send_as_task(connection, fun=hello_task, args=("Kombu", ),
+ send_as_task(connection, fun=hello_task, args=("Kombu", ), kwargs={},
priority="high")
diff --git a/examples/simple_task_queue/worker.py b/examples/simple_task_queue/worker.py
index fb9e9a7c..14038712 100644
--- a/examples/simple_task_queue/worker.py
+++ b/examples/simple_task_queue/worker.py
@@ -8,11 +8,14 @@ from queues import task_queues
class Worker(ConsumerMixin):
+ def __init__(self, connection):
+ self.connection = connection
+
def get_consumers(self, Consumer, channel):
- return Consumer(queues=task_queues,
- callbacks=[self.process_task])
+ return [Consumer(queues=task_queues,
+ callbacks=[self.process_task])]
- def process_task(body, message):
+ def process_task(self, body, message):
fun = body["fun"]
args = body["args"]
kwargs = body["kwargs"]
@@ -21,7 +24,7 @@ class Worker(ConsumerMixin):
if __name__ == "__main__":
from kombu import BrokerConnection
- from kombu.log import setup_logging
+ from kombu.utils.debug import setup_logging
setup_logging(loglevel="INFO")
with BrokerConnection("amqp://guest:guest@localhost:5672//") as conn: