Apama 10.3 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Order Management | Risk firewall | Creating risk firewalls | Sample code for creating risk firewall
 
Sample code for creating risk firewall
The following code executes the RiskFirewallFactory.create() action to create a risk firewall in the main context.
using com.apama.firewall.RiskFirewallFactory;
using com.apama.firewall.RiskFirewall;
 
monitor RiskFirewallExample1 {
context mainContext := context.current();
 
action onload() {
// Use a risk firewall factory to create a new risk firewall instance
// called "MyFirewall" in the current context.
// In this case, use the default configuration parameter settings.
RiskFirewall rfw :=
(new RiskFirewallFactory).create( mainContext, "MyFirewall" );
...
}
}
In the following example, the risk firewall is created in a non-main context. The use of the risk firewall factory is the same as in the previous example. The only changes are those necessary for spawning an action to a new context.
using com.apama.firewall.RiskFirewallFactory;
using com.apama.firewall.RiskFirewall;
 
monitor RiskFirewallExample2 {
context mainContext := context.current();
 
action onload() {
spawn createRiskFirewall() to context( "FirewallCtx" );
}
 
action createRiskFirewall() {
// Use a risk firewall factory to create a new risk firewall instance
// called "MyFirewall" in the current context.
// In this case, use the default configuration parameter settings.
RiskFirewall rfw :=
(new RiskFirewallFactory).create( mainContext, "MyFirewall" );
...
}
}


Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.