Input and output mappings
The input and output mappings determine how the handler translates com.apama.oms.* events to and from com.apama.scenario.* events. Each mapping is configured as a set of <target>:<source> pairs where <target> is the field or extra parameter that will be set in the target event and <source> is the source field/parameter or an literal value if preceded with a “#” character.
For example, the following input map sets the scenario input orderPrice to be the order field price, the scenario input orderQuantity to be the order field qty and the scenario input VWAPWindow to be the literal value “100” upon receiving a new order:
{"orderPrice":"price", "orderQuantity":"qty", "VWAPWindow":"#100"}
When the scenario issues a com.apama.scenario.Update event its outputs are mapped to a com.apama.oms.OrderUpdate event based on the output mapping. For example the following output map sets the order update field qtyExecuted to be the scenario output orderQtyExecuted and sets the order update field 9101 to be the literal value “101”:
{"qtyExexcuted":"orderQtyExecuted", "9101":"#101"}
The scenario order handler does not distinguish between “real” top level fields and extra parameters. If the named field exists in the target then it will be set, otherwise an extra parameter of that name will be set. The same works in reverse except that if a source parameter or field doesn't exist, it will be set as blank in the target.
In the case of handling OrderCancel events, there are two options. The default option is to simply delete the scenario instance. However this may not be useful in many cases as it does not allow the scenario to do anything before exiting or even reject the cancel request. The second option is to nominate a scenario input (using the configuration parameter CancelFlag) to be edited to true thereby allowing the scenario to take appropriate action before exiting.