Skip to main content

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

OperationTables Written
Service createdsvc, cb (initial state)
Request madelog, cb (state update)
Event rule matchedtask_adhoc (queue)
Task dispatched successfullylog, cb
Task failed (< 5 attempts)log, cb, task_adhoc (updated custom_data)
Task permanently failedlog, cb, dlq
DLQ replayedtask_adhoc (new task)
Circuit resetcb
Log purgedlog (old rows deleted)