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:
org.eclipse.stardust.engine.core.spi.monitoring.IWorklistMonitor
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.