In addition to synchronous OnixS::FIX::Session::logonAsInitiator / OnixS::FIX::Session::logout methods, there are corresponding asynchronous OnixS::FIX::Session::logonAsInitiatorAsync / OnixS::FIX::Session::logoutAsync methods. These asynchronous methods can be used when you need to avoid blocking the current thread by the long synchronous operation. For example, it is required when Logon/Logout method is called from an inbound callback. These methods return immediately without waiting for the acknowledgment Logon/Logout message. They return the OnixS::Threading::SharedFuture object that can be used to wait for the result of the asynchronous Logon/Logout methods by the OnixS::Threading::SharedFuture::get() method. If the result is not ready, the method will block. When it completes, it either returns or throws an exception, in case there were issues during waiting for the Logon/Logout response:
const std::string
Host =
"localhost";
const int Hbi = 30;
try
{
}
{
std::clog << "FirstMessageNotLogonException: " << ex.what() << std::endl;
}
{
std::clog << "LinkErrorException: " << ex.what() << std::endl;
}
{
std::clog << "TimeoutException: " << ex.what() << std::endl;
}
{
std::clog << "UnexpectedSequenceNumberException: " << ex.what() << std::endl;
}
{
std::clog << "ConfirmationLogonMessageErrorException: " << ex.what() << std::endl;
}
catch (const std::exception & ex)
{
std::clog << "Some other exception: " << ex.what() << std::endl;
}
std::clog << "Logon is performed successfully." << std::endl;
try
{
}
{
std::clog << "LinkErrorException: " << ex.what() << std::endl;
}
{
std::clog << "TimeoutException: " << ex.what() << std::endl;
}
catch (const std::exception & ex)
{
std::clog << "Some other exception: " << ex.what() << std::endl;
}
std::clog << "Logout is performed successfully." << std::endl;