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 integrationsrc/services/mqtt-listener.ts- Active topic subscription and serviceAgent routingsrc/examples/mqtt-listener-example.ts- Usage demonstration
Topic Patterns¶
emit/ABS/BSS/+/+- ABS application, BSS contextemit/+/BSS/+/+- Any application, BSS contextemit/ABS/+/+/+- ABS application, any contextemit/+/+/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¶
- Messaging System: Uses existing ABSEnvelope and topic building functions
- Orchestrator: Routes through MessageRouter and AgentMessageHandler
- 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