Back to Catalog
Integration
Message Construction
Command Message
Tell another app to do something — via message, not a direct call.
Intent & Description
Real-world Use Case
Order Service wants Inventory Service to reserve stock. Instead of a sync HTTP call, it sends a ReserveStock command message to a queue. Inventory processes it when ready — Order Service is not blocked.
Source
📌 TL;DR
Command Message = async RPC over a queue. Tell the other service what to do, move on. No waiting, no tight coupling.
Advantages
- Fire-and-forget async invocation — caller is never blocked
- Decouples caller from callee at runtime (receiver can be down, message queues)
- Naturally retry-able — message stays in queue until processed
- Works great with at-least-once delivery brokers (SQS, RabbitMQ)
Disadvantages
- No immediate confirmation — caller must use reply patterns to know the outcome
- Error handling is harder than a try/catch on a sync call
- Requires messaging infrastructure (broker, queue, consumer)
- Harder to trace than a direct HTTP call without distributed tracing