Sample code for registering rule class and specifying callback
The sample code below shows registration of a rule class along with specification of a callback.
using com.apama.firewall.RiskFirewallFactory;
using com.apama.firewall.RiskFactory;
using com.apama.firewall.rules.OrderPriceLimitRiskFirewallRule;
monitor RiskFirewallExample11 {
action onload() {
// Create a new risk firewall instance.
RiskFirewall rfw := (new RiskFirewallFactory).
create( context.current(), "MyFirewall" );
// Register a risk firewall rule class with the
// new risk firewall instance and specify a callback.
rfw.registerRuleClassCb( (new OrderPriceLimitRiskFirewallRule).
create(), cbOnRuleClassRegistered );
}
// This action is called upon successful registration.
action cbOnRuleClassRegistered(
RiskFirewall rfw, string ruleClassName ) {
log "Successfully registered RuleClass: "+ruleClassName;
}
}