Apama Capital Markets Foundation 10.15 | Capital Markets Foundation | Order Management | Risk firewall | Setting up risk firewall evaluation rules | Sample code for registering rule class and specifying callback
 
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;
}
}