This content needs improvements
  • Design considerations needs details about command messages characteristics
  • Usage section need detailed examples
  • Reference section need more links to samples, source code, etc.
You are welcome to edit this page. You can search for and contribute to previous discussions about this page or start a new one .

Command Messages

This document provides information about the design, implementation, and intended usage of command messages in Axon Framework.

Design considerations

Commands are specific type of messages, used to express and an intent. To distinguish them from other message types, the framework must provide a dedicates objects.

In addition to the generic messages, command messages have the following characteristics:

Name

Implementation

In Axon Framework, a command message is an immutable, serializable Java object implementing the CommandMessage interface.

Command messaging class diagram
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

Reference

Javadoc
  •  

Source code
  •