Skip to content

MQTT Integration Architecture

Overview

MQTT listener pattern enables ABS microservice to actively subscribe to MQTT topics and invoke serviceAgent functions based on service_plan_id extraction.

Implementation Files

  • src/core/mqtt-client.ts - MQTT messaging with ABS envelope integration
  • src/services/mqtt-listener.ts - Active topic subscription and serviceAgent routing
  • src/examples/mqtt-listener-example.ts - Usage demonstration

Topic Patterns

  • emit/ABS/BSS/+/+ - ABS application, BSS context
  • emit/+/BSS/+/+ - Any application, BSS context
  • emit/ABS/+/+/+ - ABS application, any context
  • emit/+/+/plan/+/+ - Plan-specific messages

Service Plan ID Extraction

Extracts service_plan_id from: 1. Envelope plan_id field 2. Topic recipient ID (e.g., plan-123) 3. Topic patterns matching plan-{id}

Integration Points

  1. Messaging System: Uses existing ABSEnvelope and topic building functions
  2. Orchestrator: Routes through MessageRouter and AgentMessageHandler
  3. Agent System: Invokes serviceAgent via AgentPluginRegistry

Usage

const stateProvider = new InMemoryPlanStateProvider();
const orchestrator = new ABSOrchestrator(stateProvider);
const mqttListener = createMQTTListenerService(orchestrator, stateProvider);
await mqttListener.start();

Benefits

  • Active listening to relevant MQTT topics
  • Context-aware service plan extraction
  • Seamless integration with existing infrastructure
  • Development-friendly with mock implementations