OnixS C++ CME iLink 3 Binary Order Entry Handler  1.16.1
API Documentation
Fault Tolerance

Backup Session

The backup session must use the same Universally Unique Identifier (UUID) as the primary session.

Before establishing the connection with the backup Market Segment Gateway, call OnixS::CME::iLink3::Session::faultToleranceIndicator(..) with the OnixS::CME::iLink3::Messaging::FTI::Backup argument.

A backup session must be ready to activate in the same data state as the previous primary session being replaced. For example, inbound and outbound sequence numbers for a UUID must be maintained in a consistent state during failover between both sessions.
See also
The Fault Tolerance CME article.

Primary Session Failure

If the exchange does not receive a message from the primary session within two times the OnixS::CME::iLink3::SessionSettings::keepAliveInterval() value, then the exchange designates the primary session as failed and initiates the failover:

Primary Market Segment Gateway Failure

If the primary Market Segment Gateway Gateway fails, then the exchange initiates failover by electing the backup Market Segment Gateway to assume the primary role.

The backup session connected to this newly chosen Market Segment Gateway must act as the primary one. It is notified about the failover via the OnixS::CME::iLink3::SessionListener::onFailover callback.

After the failover the OnixS::CME::iLink3::Session::faultToleranceIndicator() method returns OnixS::CME::iLink3::Messaging::FTI::Primary.


class MySessionListener : public OnixS::CME::iLink3::SessionListener
void onFailover(
) override
std::clog << "Primary Market Segment Gateway Failure, faultToleranceIndicator=" << faultToleranceIndicator << std::endl;
assert(FTI::Primary == faultToleranceIndicator);
void onTerminate(const Messaging::Terminate507& message, Session* /* session */) override
if (TerminateErrorCode::DisconnectFromPrimary == message.errorCodes())
std::clog << "Primary Session Failure." << std::endl;
~MySessionListener() override {};
const int MarketSegmentId = 54;
MySessionListener listener;
Session primary(settings, MarketSegmentId, &listener);
primary.connect(PrimaryGateway, GatewayPort);
Session backup(
backup.connect(BackupGateway, GatewayPort);