Data Flow
This document provides detailed end-to-end flow diagrams for every execution path in MIH.
Path 1: Direct MIH API Call (Synchronous)
Used when a plugin calls mih::request() directly and needs the response immediately.
Path 2: Event Bridge (Asynchronous)
Used when an administrator creates a rule mapping a Moodle event to a service.
Phase A: Event Capture (Synchronous, in the user's request)
Phase B: Event Dispatch (Asynchronous, in Moodle cron)
Path 3: AMQP Response Consumption (Scheduled)
Used when a service sends responses back via a RabbitMQ queue.
Path 4: Circuit Breaker State Machine
Database Write Summary
| Operation | Tables Written |
|---|---|
| Service created | svc, cb (initial state) |
| Request made | log, cb (state update) |
| Event rule matched | task_adhoc (queue) |
| Task dispatched successfully | log, cb |
| Task failed (< 5 attempts) | log, cb, task_adhoc (updated custom_data) |
| Task permanently failed | log, cb, dlq |
| DLQ replayed | task_adhoc (new task) |
| Circuit reset | cb |
| Log purged | log (old rows deleted) |