Search in sources :

Example 1 with CommandFactory

use of io.spine.client.CommandFactory in project core-java by SpineEventEngine.

the class InvalidProjectNameSubscriber method on.

@Subscribe
public void on(InvalidProjectName rejection, RjUpdateProjectName commandMessage, CommandContext context) {
    final CommandFactory commandFactory = TestActorRequestFactory.newInstance(InvalidProjectNameSubscriber.class).command();
    final Command command = commandFactory.createWithContext(commandMessage, context);
    this.rejectionHandled = Rejections.createRejection(rejection, command);
}
Also used : Command(io.spine.core.Command) CommandFactory(io.spine.client.CommandFactory) Subscribe(io.spine.core.Subscribe)

Example 2 with CommandFactory

use of io.spine.client.CommandFactory in project core-java by SpineEventEngine.

the class AbstractCommandRouter method produceCommand.

private Command produceCommand(Message commandMessage) {
    final CommandContext sourceContext = source.getContext();
    final CommandFactory commandFactory = commandFactory(sourceContext);
    final Command result = commandFactory.createBasedOnContext(commandMessage, sourceContext);
    return result;
}
Also used : CommandContext(io.spine.core.CommandContext) Command(io.spine.core.Command) CommandFactory(io.spine.client.CommandFactory)

Aggregations

CommandFactory (io.spine.client.CommandFactory)2 Command (io.spine.core.Command)2 CommandContext (io.spine.core.CommandContext)1 Subscribe (io.spine.core.Subscribe)1