Interface CommandMessage<T>

Type Parameters:
T - The type of payload contained in the message
All Superinterfaces:
Message<T>, Serializable
All Known Implementing Classes:
GenericCommandMessage, GrpcBackedCommandMessage

public interface CommandMessage<T> extends Message<T>
Represents a Message carrying a command as its payload. These messages carry an intention to change application state.
Since:
2.0
Author:
Allard Buijze
  • Method Details

    • getCommandName

      String getCommandName()
      Returns the name of the command to execute. This is an indication of what should be done, using the payload as parameter.
      Returns:
      the name of the command
    • withMetaData

      CommandMessage<T> withMetaData(@Nonnull Map<String,?> metaData)
      Returns a copy of this CommandMessage with the given metaData. The payload remains unchanged.

      While the implementation returned may be different than the implementation of this, implementations must take special care in returning the same type of Message (e.g. EventMessage, DomainEventMessage) to prevent errors further downstream.

      Specified by:
      withMetaData in interface Message<T>
      Parameters:
      metaData - The new MetaData for the Message
      Returns:
      a copy of this message with the given MetaData
    • andMetaData

      CommandMessage<T> andMetaData(@Nonnull Map<String,?> metaData)
      Returns a copy of this CommandMessage with it MetaData merged with the given metaData. The payload remains unchanged.
      Specified by:
      andMetaData in interface Message<T>
      Parameters:
      metaData - The MetaData to merge with
      Returns:
      a copy of this message with the given MetaData