Having a DTO representation of Commands (or more precisely, any object implementing HasCommandDto
offers the ability to move or copy it across the network, for example to support replay scenarios.
This is used for example by Command Log extension to return persisted representations of commands.
The conversion is performed by an in-built implementation of the ContentMappingService SPI.
The CommandDtoProcessorService
SPI provides a mechanism to post-process the CommandDto
of any objects being serialized across the network.
For example, the Command Replay extension provides an implementation in order to copy information about the outcome of each command on the primary system into the userData
map of CommandDto
.
Another use case is to strip out large blobs for performance reasons.