Skip to content

Commit

Permalink
Merge pull request #80 from duggalsu/enable_rabbitmq
Browse files Browse the repository at this point in the history
Enable RabbitMQ
  • Loading branch information
duggalsu authored Feb 15, 2024
2 parents 03915d3 + 8fb6d1f commit e055a24
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
36 changes: 18 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -57,8 +57,8 @@ services:
depends_on:
store:
condition: service_started
# queue:
# condition: service_started
queue:
condition: service_started

indexer:
container_name: feluda_indexer
Expand All @@ -71,8 +71,8 @@ services:
depends_on:
store:
condition: service_started
# queue:
# condition: service_started
queue:
condition: service_started

# reporter:
# container_name: feluda_reporter
Expand Down
18 changes: 9 additions & 9 deletions src/api/core/feluda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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)

Expand All @@ -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()
Expand All @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion src/api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit e055a24

Please sign in to comment.