Direct messaging is synchronous communication in which one microservice sends a message to one specifically addressed microservice and receives an immediate response. Messages usually act as commands that trigger an action, although they can also notify the recipient of an event. section 5.6.1 section 5.6
Use direct messaging when the sender needs explicit control over the interaction:
- Address one microservice by name and confirm immediately whether message handling succeeded or failed. section 5.11
- Sequence subsequent messages after an earlier operation completes. section 5.9
- Let a controller microservice orchestrate a defined order of behavior across several other microservices. section 5.7.6
Recording a viewed video
A video-streaming microservice sends a “Viewed” message directly to the history microservice. The sender addresses that recipient explicitly and learns immediately whether the message was handled successfully. section 5.6.1 section 5.7.7
Figure 5.9 Direct messaging allows one controller microservice (here, Microservice A) to orchestrate complex behaviors across multiple other microservices.
The orchestration diagram helps trace how one controller microservice coordinates multiple recipients through direct responses. section 5.7.6
Direct messaging makes message order and control easy to follow, but couples the sender tightly to a single recipient. Central orchestration can also create a single point of failure: a controller crash may leave a complex operation inconsistent or unfinished. Indirect messaging is preferable when decoupling, broadcasting, or independently paced services matter more. section 5.7.7 section 5.9
