Apama Capital Markets Foundation Documentation : Capital Markets Foundation : Legacy Market Data Management : Market data gateway service
Market data gateway service
The market data gateway service enforces transactional behavior on market data (Depth and Tick) events processed by the CMF. This ensures that all effects of each market data update within the CMF, for example, changes to tracked positions, are known before the update itself or any events that depend on it are delivered to the application. From the application’s perspective, using market data through the gateway is straightforward:
1. The application subscribes to market data in the usual way, by routing a com.apama.marketdata.SubscribeDepth or com.apama.marketdata.SubscribeTick event with the appropriate parameters for the adapter or other datasource. However, rather than routing the subscription request directly to the adapter service, it is routed to the gateway service instead. For example, to subscribe to market depth for a symbol on the "FIX" service:
// Extra parameters for subscription dictionary<string,string>
extraParams := new dictionary<string,string>;
// Without the gateway route
com.apama.marketdata.SubscribeDepth("FIX", "MyFIX", "EUR/USD", extraParams);
// With the gateway com.apama.marketdata.Constants mdConstants;
extraParams.add(mdConstants.TARGET_SERVICE_EXTRA_PARAM(), "FIX");
route com.apama.marketdata.SubscribeDepth(
"MyFIX", "EUR/USD", extraParams);
Notice that the subscription request is routed to the service named by the SERVICE_NAME_EXTERNAL constant and that the name of the real service should be the value of the extra parameter key named by the TARGET_SERVICE_EXTRA_PARAM constant.
2. The gateway will route a subscription to the target service and set up a listener for Depth events arriving from that service.
3. When a Depth event from the target service is received by the gateway listener, the gateway re-routes the Depth event within the CMF correlator, so it can be processed by position-keeping and other analytic components.
4. Once all the CMF’s internal processing of the Depth event is complete, it will be re-routed with the original (that is, the gateway) service name to be picked up by any listeners created in the application:
com.apama.marketdata.Depth depth;
on all com.apama.marketdata.Depth(symbol="EUR/USD"):depth {
if depth.extraParams[mdConstants.SERVICE_EXTRA_PARAM()] :=
mdConstants.SERVICE_NAME_EXTERNAL() then {

// Handle this Depth event
Note that because the service name is not a top-level field in the Depth event, the application should check the value of the extra parameters key named by the SERVICE_EXTRA_PARAM constant.
There is a performance implication to using the market data gateway service. Every incoming market data update is re-routed twice: once to be processed by the CMF’s internal analytics, then again to be processed by the application. This will have an effect on the maximum throughput and minimum latency that can be achieved when the gateway service is used. However, this impact must be weighed against the application correctness benefits of using the gateway service. Without the transactional guarantees provided by the gateway service, an application might receive a position update before, or after, the market data event that triggered the position change, depending on minor details of the implementation. For some applications, this might not matter, but if it does, the gateway service is a convenient mechanism for ensuring reliable application behavior.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback