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::CME::MDH::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.
Multiple Handler instances can share a single instance of the Feed Engine:
If the Feed Engine implementation supports multithreaded processing, it is possible to distribute the Feed Engine logic across multiple threads instead of calling OnixS::CME::MDH::NetFeedEngine::process() from one thread only.
The SDK offers the OnixS::CME::MDH::FeedEngineThreadPool service that cyclically invokes the OnixS::CME::MDH::NetFeedEngine::process method of the associated OnixS::CME::MDH::NetFeedEngine instance from a set of threads. This service manages a thread pool. When a class instance is created, it creates working threads. The number of threads is defined by the OnixS::CME::MDH::ThreadPoolSettings::size parameter, which can be accessed via the OnixS::CME::MDH::FeedEngineThreadSettings::pool member. Each thread cyclically calls the OnixS::CME::MDH::NetFeedEngine::process member for the instance of the OnixS::CME::MDH::NetFeedEngine class given to the service instance at construction time.
All events exposed by the service are encapsulated into the OnixS::CME::MDH::FeedEngineThreadPoolListener class. Subscribing to events is done during the service construction.
The Feed Engine abstraction is represented as a set of abstract classes. Implementing them allows users to build their logic by extracting market data from various sources, including networks, file-based stores, etc.
To implement a custom feed engine, please contact OnixS Support.