Event-Driven Architecture Overview
The MATIH Platform uses an event-driven architecture alongside synchronous REST APIs to handle asynchronous communication, cross-service coordination, and real-time updates. This section documents the event infrastructure, including Apache Kafka for durable event streaming and Redis Pub/Sub for ephemeral real-time notifications.
Event Infrastructure
| System | Use Case | Delivery | Persistence |
|---|---|---|---|
| Apache Kafka | Durable events, cross-service coordination | At-least-once (idempotent producers) | Yes (configurable retention) |
| Redis Pub/Sub | Real-time notifications, config broadcasts | At-most-once (fire-and-forget) | No |
The selection rule is straightforward: if the event must not be lost, use Kafka; if the event is ephemeral and latency matters more than durability, use Redis Pub/Sub.
Sections
| Section | Description |
|---|---|
| Kafka Topology | Cluster configuration, topic design, partitioning strategy |
| Event Schemas | The DataPlaneEvent base class, categories, chaining |
| Redis Pub/Sub | Real-time channels, config propagation, AI streaming |
| WebSocket Architecture | Browser-to-server real-time communication |
| CDC Patterns | Change Data Capture for database synchronization |
Event Flow Summary
Producer Service
|
+-- Durable events --> Kafka --> Consumer Services
| (audit, billing, notification)
|
+-- Real-time events --> Redis Pub/Sub --> WebSocket Bridge --> Browser
| (AI streaming, config updates)
|
+-- Database changes --> CDC (Debezium) --> Kafka --> Flink/ConsumersRelated Sections
- Service Topology -- How events flow between services
- Multi-Tenancy -- Tenant isolation in event streams
- Data Flow -- Events in the context of request processing