diff --git a/examples/simple_task_queue/client.py b/examples/simple_task_queue/client.py index 8cad069e..2cbd8f92 100644 --- a/examples/simple_task_queue/client.py +++ b/examples/simple_task_queue/client.py @@ -13,11 +13,11 @@ def send_as_task(connection, fun, args=(), kwargs={}, priority='mid'): routing_key = priority_to_routing_key[priority] with producers[connection].acquire(block=True) as producer: - maybe_declare(task_exchange, producer.channel) producer.publish(payload, serializer='pickle', compression='bzip2', exchange=task_exchange, + declare=[task_exchange], routing_key=routing_key) if __name__ == '__main__': diff --git a/examples/simple_task_queue/worker.py b/examples/simple_task_queue/worker.py index 807542e9..7f62445d 100644 --- a/examples/simple_task_queue/worker.py +++ b/examples/simple_task_queue/worker.py @@ -14,6 +14,7 @@ class Worker(ConsumerMixin): def get_consumers(self, Consumer, channel): return [Consumer(queues=task_queues, + accept=['pickle', 'json'], callbacks=[self.process_task])] def process_task(self, body, message): @@ -30,10 +31,12 @@ class Worker(ConsumerMixin): if __name__ == '__main__': from kombu import Connection from kombu.utils.debug import setup_logging - setup_logging(loglevel='INFO') + # setup root logger + setup_logging(loglevel='INFO', loggers=['']) with Connection('amqp://guest:guest@localhost:5672//') as conn: try: - Worker(conn).run() + worker = Worker(conn) + worker.run() except KeyboardInterrupt: print('bye bye')