Once the Handler is started, it listens to a market data from the network, processes it and invokes client code for further processing.
The Handler processes market data asynchronously and uses concept of events and event listeners to notify client code about a particular occasion like reception of record.
For each event like Error Occurred Handler provides an interface (C++ class with pure virtual members) like OnixS::SURF::MarketData::ErrorListener
. Client code must implement this interface (C++ class) to be able to handle events of a particular type. Handler also exposes a member like OnixS::SURF::MarketData::Handler::registerErrorListener
which allows to associate an instance of the event handler with a appropriate event in bounds of a particular instance of the OnixS::SURF::MarketData::Handler
class.
OnixS::SURF::MarketData::Handler
class must be performed while the Handler is in stopped state. Once the Handler is started, changing listener-event associations is not allowed and may lead to unpredictable behavior as well as may cause unexpected errors.Associating event listener with an instance of the OnixS::SURF::MarketData::Handler
class is also called subscribing to an event.
There're multiple events exposed by the Handler. All events can be logically divided onto high- and low-level events sub-set. High-level events reflect various results of market data processing done by the Handler like Logon Refresh Complete or Record received. Low-level events are designed for more control over data processing as well for more flexibility and described in different section of this documentation including Advanced Programming section.
Below table describes primary high-level events exposed by the Handler as well as depicts correspondence between events, interfaces for listeners and the Handler's members to subscribe to an event:
Event | Listener (C++ class) to be implemented | Handler's member to register listener | Description |
---|---|---|---|
Logon Refresh Complete record received | OnixS::SURF::MarketData::RecordListener::onLogonRefreshComplete | OnixS::SURF::MarketData::Handler::registerRecordListener | Occurs when corresponding status record is received. |
Record received | OnixS::SURF::MarketData::RecordListener::onRecord | OnixS::SURF::MarketData::Handler::registerRecordListener | Occurs when record is received. |