SchemaCommandswhere are a number of concrete command types. The
SchemaCommandsis a factory that instantiates all the concrete command types as needed. See the main source for full details, such as all necessary imports, etc.
SchemaCommandsparent is instantiated with the
Stageand the number of
routeesto be create for the router. The constructor creates a new
CommandRouterthat is the type used for
SchemaCommandsinstance exists, it can be used to instantiate individual command instances. The first factory used is
categorizeAs()that instantiates a
CategorizeAsthat is wrapped in a
RoutableCommandgeneric type parameters are as follows:
Pprotocol is the
Schemadomain model interface.
Ccommand type is
SchemaState, which is the type used to hold and transfer the
Schematype's immutable state data.
Category. First the
CategorizeAsconcrete command type itself is instantiated with the two parameters. Next the instance of
CategorizeAsis wrapped by a new
RoutableCommand, and it is then routed. Finally the
RoutableCommandis answered from the factory.
RoutableCommandanswer is used to receive the
SchemaStateinstance when it arrives by way of the
Completes<SchemaState>. The REST resource handler type
SchemaResourceinitially received an HTTP
PATCHrequest and used the
categorizeAs()in order to create the
RoutableCommand. Once the
RoutableCommandis returned to the
SchemaResourcerequest handler, the request handler registers a function on the
Completes<SchemaState>that will deliver the eventual outcome when it arrives.
CategorizeAscommand type itself plays and important role beyond carrying a parameter payload. When the router is ready to delivery the command, it uses the command itself to perform the dispatching.
CategorizeAscommand to its destination, the router uses the
CommandDispatcher, a Java functional interface, to do so. The
accept()method sends the
categorizeAs()message and parameters to the
SchemaEntityactor through its registered protocol.