CommandRouting

public final class CommandRouting<I> extends MessageRouting<M, C, R>

A routing schema used by a CommandDispatcher for delivering a command to its handler.

A routing schema consists of a default route and custom routes per command class. When finding a command target, the CommandRouting will see if there is a custom route set for the type of the command. If not found, the default route will be applied.

Parameters

<I>

the type of the entity IDs of this repository

Functions

Link copied to clipboard
public final CommandRoute<I, CommandMessage> defaultRoute()
Obtains the default route used by the schema.
Link copied to clipboard
public Optional<CommandRoute<I, M>> get<M extends CommandMessage>(Class<M> commandClass)
Obtains a route for the passed command class.
Link copied to clipboard
public static CommandRouting<I> newInstance<I>(Class<I> idClass)
Creates a new command routing.
Link copied to clipboard
public CommandRouting<I> replaceDefault(CommandRoute<I, CommandMessage> newDefault)
Sets new default route in the schema.
Link copied to clipboard
public CommandRouting<I> route<M extends CommandMessage>(Class<M> commandType, CommandRoute<I, M> via)
Sets a custom route for the passed command type.

Inherited functions

Link copied to clipboard
public BiFunction<T, U, V> andThen<V>(Function<? extends Object, ? extends V> after)
Link copied to clipboard
public R apply(M message, C context)
Obtains IDs of entities to which the passed message should be delivered.
public abstract R apply(T p, U p1)
Link copied to clipboard
public void remove(Class<? extends M> messageClass)
Removes a route for the passed message class.
Link copied to clipboard
public boolean supports(Class<? extends M> messageType)
Checks if the passed message type is supported by this instance of routing.