create

open override fun <TARGET : Any> create(commandBuilder: CommandBuilder): Mono<CommandMessage<TARGET>>

Creates a CommandMessage from a CommandBuilder, applying validation and rewriters.

The process involves:

  1. Checking for registered rewriters for the command type

  2. If no rewriter found, directly convert to CommandMessage

  3. If rewriter found, validate the command and apply the rewriter

  4. Convert the rewritten builder to CommandMessage

Return

a Mono emitting the created CommandMessage

Parameters

TARGET

the type of the command body

commandBuilder

the command builder to process

See also

Throws

if rewriter returns empty Mono