4
0

Added some basic stuff
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-30 01:26:45 +02:00
parent 9d020e9895
commit e11e6ffc3b
3 changed files with 40 additions and 22 deletions

33
extractor_service/main.py Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
import logging
import os
import sys
import pika
def message_callback(ch, method, properties, body):
pass
def main():
logging.basicConfig(filename="", format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
level=logging.DEBUG if '--debug' in sys.argv else logging.INFO)
connection = pika.BlockingConnection(pika.connection.URLParameters(os.environ['PIKA_URL']))
channel = connection.channel()
channel.exchange_declare(exchange='wave-extract', exchange_type='fanout')
queue_declare_result = channel.queue_declare(queue='', exclusive=True)
queue_name = queue_declare_result.method.queue
channel.queue_bind(exchange='wave-extract', queue=queue_name)
channel.basic_consume(queue=queue_name, on_message_callback=message_callback, auto_ack=True)
try:
channel.start_consuming()
except KeyboardInterrupt:
channel.stop_consuming()
if __name__ == '__main__':
main()