CommandSubscriber

Part of the Publishing SPI . A component to receive Command s (with publishing enabled) that just completed.

API

CommandSubscriber.java
interface CommandSubscriber {
  void onReady(Command command)     (1)
  void onStarted(Command command)     (2)
  void onCompleted(Command command)     (3)
}
1 onReady(Command)

Notifies that the command will be published, and has transitioned to org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#READY .

2 onStarted(Command)

Notifies that the command has started to execute, and has transitioned to org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#STARTED .

3 onCompleted(Command)

Notifies that the command has completed and has transitioned to org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#COMPLETED

Members

onReady(Command)

Notifies that the command will be published, and has transitioned to org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#READY .

This is an opportunity for implementations to process the command, for example to persist an initial representation of it.

onStarted(Command)

Notifies that the command has started to execute, and has transitioned to org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#STARTED .

This is an opportunity for implementations to process the command, for example to update any persisted representation of it.

onCompleted(Command)

Notifies that the command has completed and has transitioned to org.apache.causeway.applib.services.command.Command.CommandPublishingPhase#COMPLETED

This is an opportunity for implementations to process the command, for example to update any persisted representations of it.

Implementations

This is an SPI, and the framework provides several implementations.

If multiple implementations of this service are registered, all will be called.

Applib (Log4j2)

The applib provides a simple implementation, CommandLogger, that just logs events as they are received.

Command Log

The Command Log module also provides an implementation, CommandSubscriberForCommandLog. This implementation persists an instance of the CommandLogEntry entity for each event.