Communicate to host
There are different ways to communicate to the host application that is running the rules. One of the is creating and raising event and let the host application handles event ActiveElementCallback via the ProcedureEngine.
HostCallBack allows to create and event and propagate it to the host application. The host application is the code that is running the rules, It can be either on client or server side.
How it works
This mechanism allows rules to communicate to outside word and send and received required information and data for processing. When an execution reaches the command, its engine will raise an event (ActiveElementCallback). If the host application has handled the event will be able to response to the event.
During raising the event inside the rule, Tag setting of the command may carry more information to the host application. Then in the host application Response property of the CallbackEventArgs can be set. After event handling is finished the execution of the rule continues. And rule will be able to retrieve data by setting the responseRef to some local parameter for later use. The key setting of the command allows the rule to send a decision key to the host application. Then application will be able to response to event based on the set key.
<Procedure name="HostCallBackSample" enabled="true">
<Define name="userName" direction="In"/>
<Define name="userRole" direction="local"/>
<HostCallback tagValue="userName" key="askUserRole" responseRef="userRole"/>
// Create your engine from a procedure execution plan named 'proc'
ProcedureEngine engine = CreateEngine(proc);
// Handles callback event of engine
engine.ActiveElementCallback += engine_ActiveElementCallback;
And later on you have the event handler
void engine_ActiveElementCallback(object sender, CallbackEventArgs e)
// you can decide based a tag value
if (e.Tag != null)
// e.g. loopup for user role
// set the response then the rules will store the value in a processing context
e.Response = "Admin";