Apama Capital Markets Foundation 10.15 | Capital Markets Foundation | Order Management | Risk firewall | Setting up risk firewall evaluation rules | Setting rule class priority
 
Setting rule class priority
Rule class priority is the order in which the risk firewall queries the rule class instances that match an order. It applies to a registered rule class and so instances of the same class that have been added to a risk firewall always have the same priority. The default behavior is that all registered rule classes have the same priority (a value of 50). If there are multiple matching rule class instances for an order then the evaluation order is unpredictable.
The RiskFirewall.setRuleClassPriority() action lets you set the order in which the risk firewall queries rule classes to evaluate orders. For example, this is useful if you want to perform a basic set of checks on an order before trying to evaluate a much more computationally expensive operation, such as breaching a specific currency limit. The setRuleClassPriority() action takes two arguments:
*ruleClassName is the name of the registered rule class you are assigning the priority to.
*ruleClassPriority is an integer that indicates the priority level. A value of zero is the highest priority and MAX_INT is the lowest priority. For convenience, three integer constants are provided (in com.apama.firewall.Consts) that make it easy to set high, medium, and low priority ranges:
*RULE_CLASS_PRIORITY_HIGH has a value of 0.
*RULE_CLASS_PRIORITY_MEDIUM has a value of 50.
*RULE_CLASS_PRIORITY_LOW has a value of 100.
For example:
using com.apama.firewall;
// This is an important rule class so check it first.
rfwIface.setRuleClassPriority(“MyImportantRuleClass”,
Consts.RULE_CLASS_PRIORITY_HIGH );

// This rule class a lot of processing so check it last.
rfwIface.setRuleClassPriority( “MyComplexRuleClass”,
RULE_CLASS_PRIORITY_LOW );

// This rule class is of medium-high importance.
rfwIface.setRuleClassPriority(“MyMiddleRuleClass”, 25 );