The Feed Engine abstractions encapsulate data receiving aspects to let the handler focus on market data processing. It also provides advanced services for using system resources to achieve the best performance and latency characteristics.
The Feed Engine logic pushes received market data to the linked Handler instances.
The OnixS::Euronext::MarketData::OptiqMdg::SocketFeedEngine is the default implementation of the Feed Engine for receiving live network data. It uses standard socket API.
The following code sample shows how to construct an instance of the Feed Engine, link it with the handler instance, and run the Feed Engine logic to let the handler process incoming market data and other events.
The SDK offers the OnixS::Euronext::MarketData::OptiqMdg::FeedEngineThreadPool service that cyclically invokes the OnixS::Euronext::MarketData::OptiqMdg::FeedEngine::process method of the associated OnixS::Euronext::MarketData::OptiqMdg::FeedEngine instance from a set of threads. This service manages a thread pool. When a class instance is created, it creates working threads.
All events exposed by the service are encapsulated into the OnixS::Euronext::MarketData::OptiqMdg::FeedEngineThreadPoolListener class. Subscribing to events is done during the service construction.
All Feed engine events are encapsulated into OnixS::Euronext::MarketData::OptiqMdg::FeedEngineThreadPoolListener class interface. OnixS::Euronext::MarketData::OptiqMdg::FeedEngineThreadPool class accepts instance of listener upon construction.
The following table uncovers Feed Engine events:
Event> | Description |
---|---|
OnixS::Euronext::MarketData::OptiqMdg::FeedEngineThreadPoolListener::onFeedEngineThreadBegin | It is invoked by Feed Engine Pool's working thread before entering master processing loop. Event callback is invoked in context of working thread allowing a subscriber to perform thread-specific turning like setting affinity or priority for the thread. |
OnixS::Euronext::MarketData::OptiqMdg::FeedEngineThreadPoolListener::onFeedEngineThreadEnd | It is invoked by Feed Engine Pool when a working thread is about to end. Event callback is invoked in context of working thread allowing subscriber to perform thread-specific cleanup like deleting data stored in thread local storage. |
OnixS::Euronext::MarketData::OptiqMdg::FeedEngineThreadPoolListener::onFeedEngineThreadIdle | It is invoked by Feed Engine Pool when a working thread is idle. At an active phase, Feed Engine working thread is running market data processing loop. A working thread may wait for incoming market data using appropriate I/O operation. Event callback also exposes parameter-variable whose value represents time interval working thread is suggested to spend sleeping to reduce races between working threads for executing pending tasks (data reception, data processing, etc.) and thus reduce load onto CPU. Value of parameter can be modified inside the callback body.
|