Monitoring Activity Instance State Changes

The Infinity Process Platform provides the Service Provider Interface IActivityInstanceMonitor to monitor activity state changes. Please refer to the according JavaDoc IActivityInstanceMonitor for detailed information on the interface.

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

import org.eclipse.stardust.common.annotations.SPI;

import org.eclipse.stardust.common.annotations.Status;
import org.eclipse.stardust.common.annotations.UseRestriction;
import org.eclipse.stardust.engine.core.runtime.beans.IActivityInstance;

@SPI(useRestriction = UseRestriction.Public, status = Status.Stable)
public interface IActivityInstanceMonitor
   void activityInstanceStateChanged(IActivityInstance activity, int newState);

The interface propagates a change of the activity instance state.

Creating a custom Implementation

To implement the IActivityInstanceMonitor interface and publish the implementation to the engine, a file named by the interface's factory has to be created in the /META-INF/services folder of the jar. Perform the following steps:

  1. Implement the interface as shown below
  2. Create a text file named org.eclipse.stardust.engine.core.spi.monitoring.IActivityInstanceMonitor. The file contents needs to be the fully qualified name of your implementation class, e.g. org.eclipse.stardust.example.ActivityInstanceMonitorImpl.
  3. Place the file into the META-INF/services folder of the jar that will contain your implementation class

Refer to chapter Configuring SPI Implementations per Tenant for details on how to configure custom Service Provider Interface implementations.

package org.eclipse.stardust.example;
import org.eclipse.stardust.engine.core.runtime.beans.IActivityInstance;
import org.eclipse.stardust.engine.core.spi.monitoring.IActivityInstanceMonitor;

public class ActivityInstanceMonitorImpl implements IActivityInstanceMonitor {

    public void activityInstanceStateChanged(IActivityInstance activity, int newState) {