This commit is contained in:
parent
a64b14b06f
commit
735888e56f
@ -55,12 +55,12 @@ def main():
|
|||||||
logging.info("Connecting to MQ service...")
|
logging.info("Connecting to MQ service...")
|
||||||
connection = pika.BlockingConnection(pika.connection.URLParameters(os.environ['PIKA_URL']))
|
connection = pika.BlockingConnection(pika.connection.URLParameters(os.environ['PIKA_URL']))
|
||||||
channel = connection.channel()
|
channel = connection.channel()
|
||||||
channel.exchange_declare(exchange=os.environ['PIKA_INPUT_EXCHANGE'], exchange_type='fanout')
|
channel.exchange_declare(exchange=os.environ['PIKA_INPUT_EXCHANGE'], exchange_type='direct')
|
||||||
|
|
||||||
queue_declare_result = channel.queue_declare(queue='', exclusive=True)
|
queue_declare_result = channel.queue_declare(queue='', exclusive=True)
|
||||||
queue_name = queue_declare_result.method.queue
|
queue_name = queue_declare_result.method.queue
|
||||||
|
|
||||||
channel.queue_bind(exchange=os.environ['PIKA_INPUT_EXCHANGE'], queue=queue_name)
|
channel.queue_bind(exchange=os.environ['PIKA_INPUT_EXCHANGE'],routing_key='feature', queue=queue_name)
|
||||||
|
|
||||||
channel.basic_consume(queue=queue_name, on_message_callback=message_callback, auto_ack=True)
|
channel.basic_consume(queue=queue_name, on_message_callback=message_callback, auto_ack=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user