Market data processing assumes performance or different procedures like a large-scale recovery to catch-up up-to-date market state on late join or requesting lost incremental data. While developing a trading solution, it's important to know in which state market data processing currently resides.
To meet needs, the SDK exposes the OnixS::CME::Streamlined::MDH::HandlerListener listener. The Handler invokes members of the given listener once instances are bound using the OnixS::CME::Streamlined::MDH::Handler::registerListener member.
The following table summaries the Handler events.
Event | Description |
---|---|
OnixS::CME::Streamlined::MDH::HandlerListener::onStarted | Invoked by the Handler when it starts market data processing due to calling the OnixS::CME::Streamlined::MDH::Handler::start member. |
OnixS::CME::Streamlined::MDH::HandlerListener::onStopped | Invoked by the Handler when it ends market data processing due to calling the OnixS::CME::Streamlined::MDH::Handler::start member. |
OnixS::CME::Streamlined::MDH::HandlerListener::onTcpRecovery | Invoked when the Handler recovers lost data via a TCP recovery feed. |
OnixS::CME::Streamlined::MDH::HandlerListener::onEndOfTcpRecovery | Invoked when the Handler accomplishes recovering lost data via a TCP feed. The Handler supplies the status of recovery (successful, incomplete, failed) as an additional parameter. |
OnixS::CME::Streamlined::MDH::HandlerListener::onRealtimeProcessing | Invoked by the Handler when real-time processing of incremental data is either started or resumed after recovery of any kind (TCP, snapshots). After invocation of the given callback, it is guaranteed that incremental data is processed as soon as it arrives and without any delays in processing. |
OnixS::CME::Streamlined::MDH::HandlerListener::onEndOfRealtimeProcessing | Invoked when the Handler suspends real-time processing of incremental data due to a processing issue or data loss. |
The configuration and settings for data processing session define the behavior of the Handler. Therefore, each market data processing pattern defines a primary sequence of events the Handler raises. Also, a sequence of events depends on the conditions the Handler occurs. For example, if data is lost, the Handler may perform recovery procedures according to its configuration. An issue may take place during recovery or data processing. Therefore, a chain of events is not strictly defined for live market data processing, although there's explicit predictability in events for each case and conditions the Handler occurs in.
The following sections guide through the Handler behavior for major cases.
When the Handler either starts or resumes processing of incremental data after recovery, it notifies about the given event via the OnixS::CME::Streamlined::MDH::HandlerListener::onRealtimeProcessing callback. Real-time processing of incremental data means that data is processed as soon as it is received without any delays (except the case when the Handler keeps out-of-order data waiting for a short period of time for missing data to arrive).
By invoking the OnixS::CME::Streamlined::MDH::HandlerListener::onRealtimeProcessing the Handler informs on the fact incremental data is not processed under other conditions like the market or TCP recovery.
If the Handler faces an issue like a gap in incremental data or book maintenance error, it suspends real-time processing of the incremental data and signals about this via the OnixS::CME::Streamlined::MDH::HandlerListener::onEndOfRealtimeProcessing. Once the callback is invoked, the Handler performs an issue handling according to its settings. For example, if the Handler detected a gap in incremental data and the TCP recovery service is bound to the Handler, it tries to recover missing packets using the TCP recovery facility. At the given stage the Handler raises events which are related to TCP recovery. Similar, if the Handler spawns a large-scale market recovery, then the events related with the market and optionally instrument recovery are raised. When an issue handling is accomplished, the Handler resumes real-time processing of incremental data and notify a user code about this using the OnixS::CME::Streamlined::MDH::HandlerListener::onRealtimeProcessing member.
CME Streamlined offers the TCP Recovery Feed to let applications recover missing data without spawning a large-scale recovery from snapshots. The Handler supports given functionality by using a bound instance of the OnixS::CME::Streamlined::MDH::TcpRecoveryService class. When a gap in incremental data is detected, the Handler suspends real-time processing of incremental data and tries to recover missing packets via the TCP recovery service. At the beginning of each attempt the Handler invokes the OnixS::CME::Streamlined::MDH::HandlerListener::onTcpRecovery callback indicating begin of the TCP recovery procedure. Once all missing packets are received and processed successfully, the Handler ends the recovery procedure and notifies about that through the OnixS::CME::Streamlined::MDH::HandlerListener::onEndOfTcpRecovery callback.
The Handler may perform multiple attempts to recover missing data through the TCP Recovery. Each time an attempt is made, pair of the OnixS::CME::Streamlined::MDH::HandlerListener::onTcpRecovery and the OnixS::CME::Streamlined::MDH::HandlerListener::onTcpRecovery callbacks is invoked. If an attempt fails, the Handler uncovers a reason of the failure as the OnixS::CME::Streamlined::MDH::RecoveryCompletionArgs::details member of the OnixS::CME::Streamlined::MDH::RecoveryCompletionArgs parameter.