# Command Message

> Tell another app to do something — via message, not a direct call.

- **Category**: Integration
- **Subcategory**: Message Construction
- **Canonical URL**: https://designpattern.fyi/patterns/command_message/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
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.





## Trade-offs


### 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)




### Considerations & Drawbacks

- 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







---
**Reference**: [Original Source](https://www.enterpriseintegrationpatterns.com/patterns/messaging/CommandMessage.html)

