The Handler exposed five major events: Exchange message received, Order Book Changed, Handler (Feed) state changed, and Error occurred.
The Exchange message received event is fired by the Handler when a subscription is started. The Handler calls the associated listener (event handler) for each message it receives. Invocation of the event handler is performed in the same thread in which the Handler::start member was called. Once the subscription is successfully started, this event will no longer be fired for subscribed markets (until the next start).
The Order Book changed event is raised by the Handler in response to notifications from the Multicast Price Feed about added or modified orders, changes in price levels, executed trades, and other events. Events of this type occur only when the subscription is active. The associated listener will never be called before Handler::start succeeds, and after the subscription is stopped using the Handler::stop member.
The Handler (Feed) state changed event is raised by the Handler when the handler's or feed's state changes.
The Error occurred event is fired by the Handler when an error condition is met. This could be a generic error, such as an inability to write to a log file, or a failure scenario, such as receiving a message from the Multicast Price Feed with an 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 ErrorListener, which has to be implemented to handle the event and a member like Handler::registerErrorListener, which allows an instance of the event handler to be associated with an appropriate event in the scope of a particular ICE iMpact Handler.
The table below depicts the correspondence between events and listeners interface:
To register a particular listener there are corresponding registerListener() member of the Handler class:
The following sample demonstrates how to receive notifications about errors that occur in the Handler: