From 81830bad3649493bf3addf6ea11bf7285279484e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Wed, 15 Apr 2020 18:09:06 +0200 Subject: [PATCH 1/2] Update 'requirements.txt' --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 6ddc380..656ca61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ Flask marshmallow Flask-Classful sentry-sdk +pika pyAudioanalysis numpy From 70a74d3807a5b75a64a76247a6326f3eb8c1b6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Wed, 15 Apr 2020 18:16:43 +0200 Subject: [PATCH 2/2] add rabbitmq code --- classification_service/utils/rabbit.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 classification_service/utils/rabbit.py diff --git a/classification_service/utils/rabbit.py b/classification_service/utils/rabbit.py new file mode 100644 index 0000000..3370599 --- /dev/null +++ b/classification_service/utils/rabbit.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import pika +from config import * + +""" +Rabbitmq setup +""" + +__author__ = '@tormakris' +__copyright__ = "Copyright 2020, Birbnetes Team" +__module_name__ = "rabbit" +__version__text__ = "1" + +credentials = pika.PlainCredentials(RABBITMQ_USERNAME, RABBITMQ_PASSWORD) +rabbitmq = pika.BlockingConnection(pika.ConnectionParameters(host=RABBITMQ_HOST, credentials=credentials)) +rabbitmq_channel = rabbitmq.channel() +rabbitmq_channel.exchange_declare(exchange=RABBITMQ_EXCHANGE, exchange_type='fanout') + +"""Usage: + from rabbit import rabbitmq_channel + rabbitmq_channel.basic_publish( + exchange=RABBITMQ_EXCHANGE, + routing_key='feature', + body=generated_tag) +""" \ No newline at end of file