Fork me on GitHub

The JDO objectstore provides an implementation of the applib BackgroundCommandService that persists the command data into a CommandJdo entity. This is mapped to an IsisCommand table.

There are two further services that can be used:

Executing the Commands

The BackgroundCommandServiceJdo only persists the Commands to a database table, it doesn't actually execute those commands. For this, you can use BackgroundCommandExecutionFromBackgroundCommandServiceJdo class, a subclass implementation of BackgroundCommandExecution. The intention is that this class is instantiated regularly (eg every 10 seconds) by a scheduler such as Quartz) to poll for Commands to be executed, and then execute them. As you might imagine, to find new Ccommands it uses the BackgroundCommandServiceJdoRepository.

An example of how to configure the Quartz scheduler can be found on the page that describes the applib BackgroundService.

Related services

This service is intended to be deployed in conjunction with the JDO implementation of the applib CommandService, which provides the ability to persist "foreground" Commands also as CommandJdos (and to the same IsisCommand table.

Note the BackgroundCommandServiceJdoRepository queries for any Commands that needs to be executed (has not yet started). Typically these will be those created explicitly through the BackgroundService API. However, Commands to be executed in the background can also be created implicitly through the @Command(executeIn=BACKGROUND) annotation, whereby the CommandContext service delegates to the configured CommandService to persist the Command. For these to be picked up, the CommandService in use should be the JDO implementation.

Put another way: just make sure you use the JDO implementations of CommandService and BackgroundCommandService together.

Register the Service(s)

Register like any other service in,\