Beispiel #1
0
def consume_example():
    consumer = Consumer(
            host="192.168.1.13",
            #host="10.0.0.13",
            consumer_exchange="exchange.push.in",
            consumer_routing_keys=["topic.push.in"],
            consumer_queue_name="queue.push",
            producer_exchange="exchange.push.out",
            producer_routing_key="topic.push.out")
    try:
        consumer.start_consuming()
    except KeyboardInterrupt:
        # Someone pressed CTRL-C, stop consuming and close
        consumer.close()
    except Exception as e:
        consumer.close()
        raise e