Added some basic stuff
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
33
extractor_service/main.py
Normal file
33
extractor_service/main.py
Normal 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()
|
Reference in New Issue
Block a user