From 8fb6d1fd32f132cfc1ee93e1f9cfe33f761580a9 Mon Sep 17 00:00:00 2001 From: Aurora <5505558+duggalsu@users.noreply.github.com> Date: Thu, 15 Feb 2024 12:46:57 +0530 Subject: [PATCH] Enable RabbitMQ - Enabled rabbitmq disabled in PR https://github.com/tattle-made/feluda/pull/74/files - Updated rabbitmq version --- docker-compose.yml | 36 ++++++++++++++++++------------------ src/api/core/feluda.py | 18 +++++++++--------- src/api/server.py | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 578a3aa2..5c21feb8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,20 +26,20 @@ services: cap_add: - IPC_LOCK -# queue: -# image: rabbitmq:3.8.7-management -# container_name: rabbitmq -# hostname: rabbit -# volumes: -# - ./.docker/rabbitmq/data:/var/lib/rabbitmq -# - ./.docker/rabbitmq/logs:/var/log/rabbitmq -# environment: -# RABBITMQ_ERLANG_COOKIE: "secret-cookie" -# RABBITMQ_DEFAULT_USER: "admin" -# RABBITMQ_DEFAULT_PASS: "Admin123" -# ports: -# - 5672:5672 -# - 15672:15672 + queue: + image: rabbitmq:3.12.12-management + container_name: rabbitmq + hostname: rabbit + volumes: + - ./.docker/rabbitmq/data:/var/lib/rabbitmq + - ./.docker/rabbitmq/logs:/var/log/rabbitmq + environment: + RABBITMQ_ERLANG_COOKIE: "secret-cookie" + RABBITMQ_DEFAULT_USER: "admin" + RABBITMQ_DEFAULT_PASS: "Admin123" + ports: + - 5672:5672 + - 15672:15672 api: container_name: feluda_api @@ -57,8 +57,8 @@ services: depends_on: store: condition: service_started -# queue: -# condition: service_started + queue: + condition: service_started indexer: container_name: feluda_indexer @@ -71,8 +71,8 @@ services: depends_on: store: condition: service_started -# queue: -# condition: service_started + queue: + condition: service_started # reporter: # container_name: feluda_reporter diff --git a/src/api/core/feluda.py b/src/api/core/feluda.py index 2d5735f2..0ecafca0 100644 --- a/src/api/core/feluda.py +++ b/src/api/core/feluda.py @@ -5,7 +5,7 @@ from core import config, store from core.server import Server from core.operators import Operator -# from core.queue import Queue +from core.queue import Queue from enum import Enum @@ -23,9 +23,9 @@ def __init__(self, configPath): self.operators = Operator(self.config.operators) if self.config.store: self.store = store.get_store(self.config.store) - # if self.config.queue: - # # print("---> 1", self.config.queue) - # self.queue = Queue.make(self.config.queue) + if self.config.queue: + # print("---> 1", self.config.queue) + self.queue = Queue.make(self.config.queue) if self.config.server: self.server = Server(self.config.server) @@ -43,8 +43,8 @@ def start(self): self.store.connect() self.store.optionally_create_index() - # if self.queue: - # self.queue.connect() + if self.queue: + self.queue.connect() if self.server: self.server.start() @@ -55,9 +55,9 @@ def start_component(self, component_type: ComponentType): elif component_type == ComponentType.STORE and self.store: self.store.connect() self.store.optionally_create_index() - # elif component_type == ComponentType.QUEUE and self.queue: - # self.queue.connect() - # self.queue.initialize() + elif component_type == ComponentType.QUEUE and self.queue: + self.queue.connect() + self.queue.initialize() else: raise Exception("Unsupported Component Type") diff --git a/src/api/server.py b/src/api/server.py index 042117bd..31238195 100644 --- a/src/api/server.py +++ b/src/api/server.py @@ -14,7 +14,7 @@ # feluda.set_endpoints([health.HealthEndpoint, index.endpoint.IndexEndpoint, search.endpoint]) # feluda.server.start() feluda.start_component(ComponentType.STORE) - # feluda.start_component(ComponentType.QUEUE) + feluda.start_component(ComponentType.QUEUE) feluda.start_component(ComponentType.SERVER) except Exception as e: log.exception("Error Initializing Search Service")