How services talk.
WHAT THE APPROACHES ARE
Synchronous request and response Asynchronous messaging
WHAT SYNCHRONOUS SUITS
Operations needing an immediate answer.
WHAT IT COSTS
The caller waits, and fails if the callee fails.
WHAT ASYNCHRONOUS SUITS
Work that can complete later Notifying other services that something happened
WHAT IT PROVIDES
Decoupling, and resilience to temporary unavailability.
WHAT IT COSTS
Eventual consistency, and more difficult reasoning.
WHAT TO PREFER
Asynchronous, where an immediate answer is not required.
WHY
Every synchronous dependency is a way your service fails.
WHAT TO ALWAYS SET
Timeouts on every call.
WHAT TO IMPLEMENT
Retries with increasing delay, for transient failures A circuit breaker, stopping calls to a failing service
WHY A CIRCUIT BREAKER
Repeatedly calling a failing service wastes resources and delays recovery.
WHAT TO ENSURE
That operations are safe to repeat.
WHY
Retries happen, and duplicates otherwise result.
WHAT TO DEFINE
A contract for every interaction, versioned.