Sample code for connecting to risk firewall and specifying callback
The following code provides an example of connecting to a risk firewall by executing the connectCb() action. After connecting to the remote risk firewall instance, the onFirewallConnected() callback is executed.
using com.apama.firewall.RiskFirewallFactory;
using com.apama.firewall.RiskFirewall;
monitor RiskFirewallExample5 {
context mainContext := context.current();
action onload() {
// Use a risk firewall factory to connect to
// a remote risk firewall instance called "MyFirewall"
// and specify a callback to be executed upon connection.
RiskFirewall rfwRemote := (new RiskFirewallFactory).
connectCb( mainContext, "MyFirewall", onFirewallConnected );
// Use the remotely connected risk firewall to
// perform any needed operations.
// Some operations may pend until the remotely connected
// risk firewall has been fully constructed and connected.
}
action onFirewallConnected(
RiskFirewall rfwRemote ) {
log "The RiskFirewall is now fully connected";
// Use the remote risk firewall to perform
// any required operations.
}
}