Apama Capital Markets Foundation 10.11 | Capital Markets Foundation | Order Management | Risk firewall | Sending orders into a risk firewall | Setting order update callbacks
 
Setting order update callbacks
You might want to do something when there is an update to an order that the risk firewall is currently handling. To do this, you can add an order update callback to an order sender object. The risk firewall executes any added order update callbacks as follows:
*Each time it receives a com.apama.oms.OrderUpdate object for an order that it is handling. The update can come from only an OrderReceiver.
*Each time it rejects an order. Typically, this is due to an order failing the evaluation of the registered rule classes. However, the risk firewall can also reject new/amend/cancel orders for other reasons, such as the risk firewall being locked, or if the amend/cancel order is for an unknown order Id.
To set an order update callback, execute com.apama.firewall.OrderSender.addOrderUpdateCallback(). This action takes one argument, which is the callback to be executed. The callback itself takes one argument, which is a com.apama.oms.OrderUpdate object. The addOrderUpdateCallback() action registers a callback with the risk firewall instance it is executed on. The registered callback is executed whenever the risk firewall receives or generates an OrderUpdate for an order that it is currently handling. You can add more than one order update callback.
The addOrderUpdateCallback() action returns a unique integer reference Id that you can use to remove the callback at a later date if required.
To remove a previously-added order update callback, execute OrderSender.removeOrderUpdateCallback() and specify the integer reference Id that was returned when you added the callback. To remove all previously-added order update callbacks, execute the OrderSender.clearOrderUpdateCallbacks() action.