From 2e3670206afa1efad6e0b79e2ec4562ffd9ed4a2 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Tue, 16 Dec 2025 22:59:44 +0000 Subject: [PATCH] Migrated Gateway to new API --- trustgraph-flow/trustgraph/gateway/service.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/trustgraph-flow/trustgraph/gateway/service.py b/trustgraph-flow/trustgraph/gateway/service.py index 3ebed6af..6303e4fc 100755 --- a/trustgraph-flow/trustgraph/gateway/service.py +++ b/trustgraph-flow/trustgraph/gateway/service.py @@ -10,6 +10,7 @@ import logging import os from trustgraph.base.logging import setup_logging +from trustgraph.base.pubsub import get_pubsub from . auth import Authenticator from . config.receiver import ConfigReceiver @@ -50,6 +51,10 @@ class Api: self.pulsar_listener = config.get("pulsar_listener", None) + # Create backend using factory + self.pubsub_backend = get_pubsub(**config) + + # Keep pulsar_client for backward compatibility with existing gateway code if self.pulsar_api_key: self.pulsar_client = pulsar.Client( self.pulsar_host, listener_name=self.pulsar_listener, @@ -174,6 +179,14 @@ def run(): help='Service identifier for logging and metrics (default: api-gateway)', ) + # Pub/sub backend selection + parser.add_argument( + '--pubsub-backend', + default=os.getenv('PUBSUB_BACKEND', 'pulsar'), + choices=['pulsar', 'mqtt'], + help='Pub/sub backend (default: pulsar, env: PUBSUB_BACKEND)', + ) + parser.add_argument( '-p', '--pulsar-host', default=default_pulsar_host,