OnixS C++ CME MDP Streamlined Market Data Handler  1.2.0
API Documentation
Using TCP Recovery Facility

Recovering from Data Loss

The Handler receives market data through the network multicast feeds. Due to a multicast nature, data may come in the wrong order or may be completely lost. The Handler does its best to fix all the network-related issues. However, packet gaps may still happen while processing market data.

The CME Streamlined provides its clients with an ability to request and obtain lost data using a reliable TCP connection. This facility is called a TCP Recovery. If the Handler is configured to use a TCP Recovery facility, in case of data loss, it doesn't report an error immediately and does not fall into a book recovery. Instead, it suspends regular processing and requests a remote system to resend missed data. The Handler resumes regular processing without restarting its execution, once it successfully receives lost packets from the service.

If a request to recover missed data through a TCP Recovery feed fails, the Handler tries to recover lost packets for a number of times defined by the OnixS::CME::Streamlined::MDH::TcpRecoverySettings::reconnectAttempts parameter. The Handler waits for OnixS::CME::Streamlined::MDH::TcpRecoverySettings::reconnectInterval milliseconds before a new attempt to recover lost data is made. If the Handler was not able to recover lost packets for a predefined number of attempts, it spawns a recovery from snapshots or continues real-time processing as defined by session settings.

Enabling TCP Recovery

It is necessary to contact CME support for TCP Recovery credentials to be able to use a TCP Recovery facility.

Also, the CME does not allow multiple recovery requests served simultaneously using the same credentials. Only one TCP recovery session can be active at a time. For this reason, the SDK exposes a TCP recovery feature as a shared service which can be bound to multiple Handler instances. Implementation of this feature covers all synchronization related aspects to avoid multiple requests at the same time.

The following example demonstrates how to use TCP Recovery with the Handler:

// Configuring TCP Recovery.
TcpRecoverySetting tcpRecoverySettings;
// Credentials are to be set as there's no defaults for
// these parameters. Other parameters have default values.
tcpRecoverySettings.username("CME");
tcpRecoverySettings.password("CME");
// Constructing instance of TCP Recovery
// service and binding to the Handler.
TcpRecoveryService tcpRecovery(tcpRecoverySettings);
// Configuring Handler.
HandlerSettings handlerSettings;
handlerSettings.channel(231);
handlerSettings.feeds().connectivityConfigurationFile("config.xml");
Handler handler(handlerSettings);
// Since this call, Handler will use
// TCP recovery in case of data loss.
handler.bindTcpRecovery(tcpRecovery);