From 7d3d50f188b1e5c5cba1e22f321690fd40c62df3 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Tue, 24 Jun 2025 10:12:32 +0100 Subject: [PATCH] Fix gateway/rev-gateway duplicate naming --- .../trustgraph/gateway/dispatch/manager.py | 15 ++++++++------- trustgraph-flow/trustgraph/gateway/service.py | 1 + .../trustgraph/rev_gateway/dispatcher.py | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/trustgraph-flow/trustgraph/gateway/dispatch/manager.py b/trustgraph-flow/trustgraph/gateway/dispatch/manager.py index 189ea5e3..0b5b26f1 100644 --- a/trustgraph-flow/trustgraph/gateway/dispatch/manager.py +++ b/trustgraph-flow/trustgraph/gateway/dispatch/manager.py @@ -81,10 +81,11 @@ class DispatcherWrapper: class DispatcherManager: - def __init__(self, pulsar_client, config_receiver): + def __init__(self, pulsar_client, config_receiver, prefix="api-gateway"): self.pulsar_client = pulsar_client self.config_receiver = config_receiver self.config_receiver.add_handler(self) + self.prefix = prefix self.flows = {} self.dispatchers = {} @@ -133,8 +134,8 @@ class DispatcherManager: dispatcher = global_dispatchers[kind]( pulsar_client = self.pulsar_client, timeout = 120, - consumer = f"api-gateway-{kind}-request", - subscriber = f"api-gateway-{kind}-request", + consumer = f"{self.prefix}-{kind}-request", + subscriber = f"{self.prefix}-{kind}-request", ) await dispatcher.start() @@ -226,8 +227,8 @@ class DispatcherManager: ws = ws, running = running, queue = qconfig, - consumer = f"api-gateway-{id}", - subscriber = f"api-gateway-{id}", + consumer = f"{self.prefix}-{id}", + subscriber = f"{self.prefix}-{id}", ) return dispatcher @@ -268,8 +269,8 @@ class DispatcherManager: request_queue = qconfig["request"], response_queue = qconfig["response"], timeout = 120, - consumer = f"api-gateway-{flow}-{kind}-request", - subscriber = f"api-gateway-{flow}-{kind}-request", + consumer = f"{self.prefix}-{flow}-{kind}-request", + subscriber = f"{self.prefix}-{flow}-{kind}-request", ) elif kind in sender_dispatchers: dispatcher = sender_dispatchers[kind]( diff --git a/trustgraph-flow/trustgraph/gateway/service.py b/trustgraph-flow/trustgraph/gateway/service.py index 97406422..ee66b9d3 100755 --- a/trustgraph-flow/trustgraph/gateway/service.py +++ b/trustgraph-flow/trustgraph/gateway/service.py @@ -73,6 +73,7 @@ class Api: self.dispatcher_manager = DispatcherManager( pulsar_client = self.pulsar_client, config_receiver = self.config_receiver, + prefix = "gateway", ) self.endpoint_manager = EndpointManager( diff --git a/trustgraph-flow/trustgraph/rev_gateway/dispatcher.py b/trustgraph-flow/trustgraph/rev_gateway/dispatcher.py index 39c45cfc..0eba62a1 100644 --- a/trustgraph-flow/trustgraph/rev_gateway/dispatcher.py +++ b/trustgraph-flow/trustgraph/rev_gateway/dispatcher.py @@ -35,7 +35,7 @@ class MessageDispatcher: # Use DispatcherManager for flow and service management if pulsar_client and config_receiver: - self.dispatcher_manager = DispatcherManager(pulsar_client, config_receiver) + self.dispatcher_manager = DispatcherManager(pulsar_client, config_receiver, prefix="rev-gateway") else: self.dispatcher_manager = None logger.warning("No pulsar_client or config_receiver provided - using fallback mode")