Fork me on GitHub

The CommandService service supports the CommandContext service such that Command objects (that reify the invocation of an action on a domain object into an object) can be persisted.

Persistent Commands support several use cases:


The screencast provides a run-through of the command (profiling) service, auditing service, publishing service. It also shows how commands can be run in the background either explicitly by scheduling through the background service or implicitly by way of a framework annotation.


The CommandService service defines the following very simple API:

public interface CommandService {

    Command create();

    void startTransaction(final Command command, final UUID transactionId);

    void complete(final Command command);

    boolean persistIfPossible(Command command);


where Command is defined as defined by the CommandContext service.


CommandService (for persistent Commands)

The CommandService interface (defined in the Isis applib) is implemented within isis-module-command-jdo by:

There is also a supporting repository to query persisted Commands:

In addition, there is a supporting contributions service that contributes actions for searching for persisted Commands for any object:


Registering the Services

Assuming that the configuration-and-annotation services installer is configured:

then the CommandServiceJdo and CommandServiceJdoRepository services are automatically registered if the isis-module-command-jdo module is on the classpath. The CommandServiceJdoContributions service (because it influences the user interface) must be explicitly registered:,\

Related Services

As discussed above, this service supports the CommandContext, providing the ability for Command objects to be persisted. This is closely related to the BackgroundCommandService that allows the BackgroundService) to schedule commands for background/asynchronous execution.

The implementations of CommandService and BackgroundCommandService are intended to go together, so that persistent parent Commands can be associated with their child background Commands.