This section discusses the Esper integration with OSWorkflow to process business event data and react with user-defined patterns.
To enable Esper functionality inside an OSWorkflow definition, we must create a way to emit events from OSWorkflow into the Esper engine.
OSWorkflow can provide this extension via a custom FunctionProvider
. This FunctionProvider
will emit events into the engine. The code for the class is as follows:
package packtpub.osw.cep; import java.util.Map; import net.esper.client.*; import com.opensymphony.module.propertyset.PropertySet; import com.opensymphony.util.BeanUtils; import com.opensymphony.workflow.FunctionProvider; import com.opensymphony.workflow.WorkflowException; /** * Function provider that sends an event to the esper engine. */ public class PushEventFunctionProvider implements FunctionProvider { public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException { // the event POJO...