There were five major events exposed by the Handler: Exchange message received, Order Book Changed, Handler (Feed) state changed and Error occurred.
Exchange message received event is fired by the Handler at the time when a subscription is being started. Handler calls associated listener (event handler) for each message it receives. Invocation of the event handler is performed in the same thread in which OnixS::ICE::iMpact::MarketData::Handler::start
member was called. Once the subscription is successfully started, the event of this type will no more be fired for subscribed markets (until next start).
Order Book changed event is raised by the Handler in response to received notifications from Multicast Price Feed about added or modified orders, changes in price levels, performed trades, etc. Events of this type occur only when the subscription is active. Associated listener will never be called before OnixS::ICE::iMpact::MarketData::Handler::start
succeed and after subscription will be stopped using OnixS::ICE::iMpact::MarketData::Handler::stop
member.
Handler (Feed) state changed event is raised by the Handler at the time when the handler' or feed' state is changed.
The Error occurred event is fired by the Handler if any error condition met. This could be a generic error like inability to write to a log file as well as some kind of failure scenario like the reception of a message from Multicast Price Feed with the invalid sequence number. This event is raised by the Handler only when a subscription is active.
For each of these events Handler provides an interface (C++ class with virtual members) like OnixS::ICE::iMpact::MarketData::ErrorListener
which has to be implemented to handle the event and a member like OnixS::ICE::iMpact::MarketData::Handler::registerErrorListener
which allows to associate instance of event handler with a appropriate event in scope of particular ICE iMpact Handler.
Below table depicts correspondence between events, interfaces for listeners and the Handler's members to subscribe to an event:
The following sample demonstrates how to receive notifications about errors occurred in the Handler: