Command Messages
This document provides information about the design, implementation, and intended usage of command messages in Axon Framework.
Implementation
In Axon Framework, a command message is an immutable, serializable Java object implementing the CommandMessage
interface.
Figure 1. Command messaging class diagram
When the communication is bidirectional, the command response is an object that implements CommandResultMessage
.
Usage
GenericCommandMessage myCommandMessage =
new GenericCommandMessage( (1)
myCommandPayload (2)
)
1 | use the constructor |
2 | pass a serializable object |
GenericCommandMessage myCommandMessage =
GenericCommandMessage.asCommandMessage( (1)
myCommandPayload (2)
)
1 | use static method |
2 | pass a serializable object |