A command message requests that a receiver perform a specified operation with specified parameters. It is the messaging equivalent of an RPC request; unlike a document, it tells the receiver what operation to invoke. section 8.3.1
Choose the interaction pattern based on whether the sender needs a reply:
- For asynchronous request/reply, send the command to the service’s point-to-point channel and include a reply-channel header. The receiver replies with a correlation ID so the sender can match the response to its request. section 8.3.2
- For a one-way notification, send the command to the service’s point-to-point channel; the service processes it without replying. section 8.3.2
Order validation
An Order Service can create an order in PENDING state, return its ID, then send ValidateConsumerInfo and ValidateOrderDetails commands to other services. Their replies drive the order’s later transition to VALIDATED. This avoids waiting for those services before responding, but the initial response gives only a partial outcome. section 8.3.9
Figure 8.12 The business logic in the sender invokes a sending port interface, which is implemented by the message sender’s adapter. The message sender sends a message to a receiver via a message channel. The message channel is an abstraction of messaging infrastructure. A message handler adapter in the receiver is invoked to handle the message. It invokes the receiving port interface implemented by the receiver’s business logic.
Shows how sender and receiver business logic connect through port interfaces, adapters, and a message channel. section 8.3.1
