The market data gateway service is used to ensure safety in the firewall.
It is there to ensure that the firewall rules have processed the market data before the algorithms receive it. That way, when the algorithm sends new orders, the latest risk data will be avaiable.
The way that the gateway works is by changing the service id on the market data events. The application code must send their subscribe and unsubscribe requests using the external service id. The actual service id that the adapter uses is specified in an extra parameter. The gateway service will then forwards those events on with the service id changed to the internal one. All the risk analytics process this. The gateway also routes an end of transaction event after the market data event. When this chaser token is received by the gateway, it knows that the subscription has been processed by all the risk analytics, and forwards it on to the adapter.
More importantly, the gateway also works in the reverse direction. The market data from the adapters is received by the gateway, and forwarded on using the internal service id. This updates the risk analytics. Again an end of transaction event is sent as a chaser. When the gateway receives the chaser it knows the risk analytics have processed the depth. It then forwards on the depth using the external service id, which should be picked up by the application.
com.apama.marketdata.Depth - This service routes the events using the internal service id, for the analytics to use, and the external service id, for the application to process.
com.apama.marketdata.SubscribeDepth - This service routes the events using the internal service id, for the analytics to use, and to the adapter to actually do the subscription
com.apama.marketdata.SubscribeTick - This service routes the events using the internal service id, for the analytics to use, and to the adapter to actually do the subscription
com.apama.marketdata.Tick - This service routes the events using the internal service id, for the analytics to use, and the external service id, for the application to process.
com.apama.marketdata.UnsubscribeDepth - This service routes the events using the internal service id, for the analytics to use, and to the adapter to actually do the unsubscription
com.apama.marketdata.UnsubscribeTick - This service routes the events using the internal service id, for the analytics to use, and to the adapter to actually do the unsubscription
Listens:
com.apama.marketdata.Depth - This service listens for events using the adapter and internal service ids, forwarding on the events to the next stage, eventually the application (using the external service id).
com.apama.marketdata.SubscribeDepth - This service listens for events using the internal and external service ids, forwarding on the events to the next stage, eventually the adapter.
com.apama.marketdata.SubscribeTick - This service listens for events using the internal and external service ids, forwarding on the events to the next stage, eventually the adapter.
com.apama.marketdata.Tick - This service listens for events using the adapter and internal service ids, forwarding on the events to the next stage, eventually the application (using the external service id).
com.apama.marketdata.UnsubscribeDepth - This service listens for events using the internal and external service ids, forwarding on the events to the next stage, eventually the adapter.
com.apama.marketdata.UnsubscribeTick - This service listens for events using the internal and external service ids, forwarding on the events to the next stage, eventually the adapter.