LSPS documentation logo
LSPS Documentation
Monitor the Start of Model Instances

Monitoring the start of model instances allows you to check if a model instance has successfully finished its start sequence, which is by default the first model transaction.

Monitoring the start of model instances is typically useful when starting restartable model instances. Restartable model instances are based on a pattern that makes sure that a model instance returns to the correct status after if finished prematurely.

Such models rely on persisted business data for their status: If a piece of business data has been already handled by the given flow element or has been otherwise processed so that the element does not need to be executed, the element is skipped. More details on the pattern are available in the tutorial on restartable models:

When finishing and subsequently starting restartable model instances with the monitoring mechanism in place, you can check when and if the model instances have reached the status they were in before restart: You can start and check the status of the model instances manually, however, it is recommended to design an orchestrating model that will start and monitor the starting of model instances over your business data.

Monitoring the Start of Model Instances

To implement the monitoring of model instance starting:

  1. Create a model with a process that will orchestrate the starting:
    1. Monitor starting of the orchestrating model: call clearApplicationRestartData() to clear the data from a previous start-monitoring run and watchStarting(thisModelInstance()), for example, from the Start assignment of the process.
    2. Make the process create model instances of the restartable model and pass it the relevant business data.
    3. Mark the place from where to start monitoring the model instances by calling watchStarting(<ModelInstanceToFollow>): At this point, the starting status of the model instance will be set to IN_PROGRESS.
      Orchestarting process with the start-watching calls on the Start Event
  2. Adapt the restartable models:
    1. Optionally, define where the start sequence finishes: By default, this is when the first transaction of the monitored model instance has been executed successfully: the starting status of the model instance is set to FINISHED. To finish the start sequence later, define the point when to finish manually.

Defining Finish of the Start Sequence

To define, when the starting of a model instance finishes explicitly do the following:

  1. Along with the watchStarting() call, call explicitFinishing() to prevent the watching from finishing after the first model transaction.
  2. Mark the finish of the start sequence with the modelInstanceStartSucceeded() call.

With the explicitFinishing() in place, the starting status of the model instance will be IN_PROGRESS_EXPLICIT_FINISH.

Defining Number of Expected Model Instances

You can define the number of expected model instances that finish their Start with the setCountOfModelInstacesToStart() call: the number is displayed in the Application restart views.

Checking the Start Progress of Model Instances

You can follow the status of starting of model instances in the Restart Application view in Management Console or in the Management perspective. Also, you can use the getStartStatus(ModelInstance modelIntance) and getStartStatuses(List<ModelInstance> listOfModelIntances) and getRestartInfo() functions of the Standard Library or the Command Line tool with the appRestartInfo and appRestartInfoExport commands.

If the status of a monitored model instance is FAILED, the start sequence of the model instance failed with an unhandled exception.

Note that the orchestrating model instance might fail as well: this will depend on whether the exception occurred within its start sequence.