Monitoring Worklists

To provide a worklist monitor which will be informed about changes to the worklist, you can implement the interface org.eclipse.stardust.engine.core.spi.monitoring.IWorklistMonitor.

package org.eclipse.stardust.engine.core.spi.monitoring;

import org.eclipse.stardust.engine.api.model.IParticipant;
import org.eclipse.stardust.engine.core.runtime.beans.IActivityInstance;

public interface IWorklistMonitor
{

   void addedToWorklist(IParticipant participant, IActivityInstance activityInstance);

   void removedFromWorklist(IParticipant participant, IActivityInstance activityInstance);

}

This pattern follows the concept of the JDK6 ServiceLoader.

The participant parameter defines the participant to whose worklist the activity instance has been added and from whose worklist the activity instance has been removed respectively. activityInstance specifies the activity instance which is affected.

Create your own implementations for this interface. To publish an implementor to the engine, a file named by the interface's factory has to be created in the /META-INF/services folder of the jar as follows:

  1. Unzip the carnot-engine.jar file, located in the root directory of the original carnot.ear file.
    Refer to chapter Creating a Stardust Runtime Environment with Apache Maven in the Installation Guide for details on how to retrieve the carnot.ear file from one of the preconfigured deployment configurations.
  2. In folder /META-INF/services, create the following file:
    org.eclipse.stardust.engine.core.spi.monitoring.IWorklistMonitor
  3. Add the fully qualified class name of your implementations to the file named as the interface, which the class implements.

The methods in this class are called (on Session.flush()) in the following cases:

Note, that the notifications are not transaction save. You will be informed even if later in transaction a rollback happens and the change is not committed to the database.