MATIH Platform is in active MVP development. Documentation reflects current implementation status.
2. Architecture
Communication Patterns

Communication Patterns

The MATIH Platform uses four communication protocols, each selected for specific interaction patterns. This section documents when and how each protocol is used across the service topology.


Protocol Overview

ProtocolPatternUse CaseLatency
REST/HTTPSynchronous request-responseInter-service calls requiring immediate response1-100ms
Apache KafkaAsynchronous event streamingFire-and-forget notifications, event sourcing10-500ms
Redis Pub/SubReal-time broadcastConfig propagation, AI streamingSub-millisecond
gRPCHigh-performance typed RPCPipeline-to-Temporal, ML-to-Ray1-10ms

REST/HTTP (Synchronous)

Used for all inter-service calls that require an immediate response:

ConventionDetails
Content typeapplication/json
AuthenticationAuthorization: Bearer <token>
Tenant contextX-Tenant-ID header
TracingX-Correlation-ID header
RetryRetryableRestClient with exponential backoff
Circuit breakerResilience4j circuit breaker per downstream service

Examples

CallerTargetPurpose
AI ServiceQuery EngineExecute generated SQL
AI ServiceCatalog ServiceFetch schema metadata
BI ServiceSemantic LayerResolve metric queries
BI ServiceRender ServiceGenerate chart images
API GatewayIAM ServiceValidate JWT tokens

Apache Kafka (Asynchronous)

Used for event notifications that do not require an immediate response:

PatternDescriptionExample
Event notificationProducer publishes, consumers react independentlyTenant provisioned event
Event-carried stateEvent payload contains all data consumers needQuery completed with result metadata
Saga coordinationEvents trigger sequential workflow stepsMulti-phase provisioning

Redis Pub/Sub (Real-Time Broadcast)

Used for ephemeral notifications where latency matters more than durability:

ChannelPublisherSubscriber
config:changesConfig ServiceAll services
ai:stream:{sessionId}AI ServiceWebSocket bridge
dashboard:refresh:{id}BI ServiceFrontend WebSocket

gRPC (High-Performance)

Used for high-throughput internal communication:

CallerTargetPurpose
Pipeline ServiceTemporalWorkflow orchestration
ML ServiceRayDistributed compute dispatch

Resilience Patterns

PatternImplementationPurpose
RetryRetryableRestClient with exponential backoffHandle transient failures
Circuit breakerResilience4j per downstream servicePrevent cascade failures
TimeoutConfigurable per-call timeoutPrevent indefinite waiting
BulkheadThread pool isolation per downstreamLimit resource consumption
FallbackCached response on circuit openGraceful degradation

Related Pages