Setting risk firewall parameters
When you create a risk firewall instance it has the same configuration parameter settings as the risk firewall factory you use to create it. Each risk firewall configuration parameter has a default setting, which is appropriate for the most common risk firewall use cases. You only need to set risk firewall parameters if the default settings do not meet your application requirements.
There are many configuration parameters that you can set to specify the behavior of a risk firewall. The constant values used to specify these configuration parameters are defined in
com.apama.firewall.Consts. See also
Default settings for risk firewall configuration parameters.
To set a configuration parameter for a particular risk firewall instance, execute the
com.apama.firewall.RiskFirewall.setParams() action on the risk firewall instance. Alternatively, you can set the configuration parameter on a risk firewall factory instance and then use that factory instance to create the risk firewall. See
Setting risk firewall factory parameters.
To set parameters on a risk firewall instance:
1. Use a risk firewall factory to create a risk firewall instance. For example:
com.apama.firewall.RiskFirewall rfw :=
(new com.apama.firewall.RiskFirewallFactory).
create(mainContext, "myRiskFirewall");
2. Create a com.apama.utils.Params object.
3. Add a parameter name/value pair to the parameters object you created.
4. Repeat the previous step for each parameter you want to set.
5. Execute the setParams() action on the risk firewall instance and pass it the Params object you created.
If the risk firewall instance is locked, the new parameters will be in effect when you unlock it. If the risk firewall instance is unlocked, the new settings affect subsequent inbound orders.
To obtain the values for any configuration parameters that have been explicitly set, either on the factory that created the risk firewall instance or on the instance itself, execute the RiskFirewall.getParams() action. This action does not return values for parameters that have the default setting.
If you set parameters on an unlocked risk firewall it might affect only subsequent orders that enter the risk firewall.
The following sample code sets a parameter on a risk firewall instance.
using com.apama.firewall.RiskFirewallFactory;
using com.apama.firewall.RiskFirewall;
using com.apama.firewall.Consts;
using com.apama.utils.Params;
// This sample demonstrates how to create and configure a risk firewall.
monitor RiskFirewallExample9 {
// Store the main context.
context mainContext := context.current();
action onload() {
// Create the risk firewall in the main context, and
// call it "MyFirewall".
RiskFirewall rfw := (
new RiskFirewallFactory).create( mainContext, "MyFirewall" );
// Modify the risk firewall configuration to use
// soft rejection mode. This provides the opportunity
// to amend orders and resubmit them.
Params rfwParams := new Params;
rfwParams.addParam(
Consts.CONFIG_REJECTION_MODE, Consts.CONFIG_REJECTION_MODE_SOFT );
rfw.setParams( rfwParams );
}
}