Microservices Integration Patterns
Choosing sync, event, Saga, and Outbox patterns with the gateway.
MSA integration combines patterns by latency sensitivity, retryability, and data consistency—not a single pattern alone.
| Pattern | Best fit | Core implementation | Caveats |
|---|---|---|---|
| Request/Response | Sync queries and approvals | Timeout, circuit breaker | Cascading latency |
| Event-driven | State change propagation | Topic, consumer group | Duplicate events (idempotency) |
| Saga | Multi-service approval | Compensating transactions | Inconsistency if compensation fails |
| Outbox | DB + event consistency | Poller / CDC | Monitor delivery lag |
Standard event schema
{
"eventId": "uuid",
"eventType": "ORDER_APPROVED",
"occurredAt": "2026-05-27T03:30:00Z",
"source": "order-service",
"correlationId": "trace-id",
"payload": {}
}
Choose a pattern
- Decide if the user needs a synchronous response vs eventual consistency.
- Check if compensation is possible and whether Saga/Outbox is needed.
- Split sync/async channels (HTTP vs MQ) in gateway routes.
- Declare idempotency keys, DLQ, and retry limits in config.
Best practice
Real-time APIs: Request/Response + CB; settlement and notifications: Event-driven + Outbox is most stable.