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.
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:
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 {
@Override
public void activityInstanceStateChanged(IActivityInstance activity, int newState) {
}
}