OnixS C++ CME iLink 3 Binary Order Entry Handler  1.13.0
API Documentation
Threading Models

The handler supports the following threading models for usual sockets: OnixS::CME::iLink3::ThreadingModel::Dedicated and OnixS::CME::iLink3::ThreadingModel::ThreadPool.

Mode OnixS::CME::iLink3::ThreadingModel::External is intended to the Solarflare TCPDirect technology that is described in Solarflare TCPDirect section.

The model is configured via the OnixS::CME::iLink3::SessionSettings::threadingModel(ThreadingModel::Enum value) method.


In OnixS::CME::iLink3::ThreadingModel::Dedicated mode the Handler creates a dedicated receiving thread and a dedicated sending thread for each OnixS::CME::iLink3::Session instance.

The receiving thread receives and processes incoming SBE messages.

The Handler tries to send an outgoing application-level message in the thread that calls the OnixS::CME::iLink3::Session::send method. If the message cannot be sent immediately, then it is saved to the queue for the subsequent sending by the sending thread. This behavior can be changed using the OnixS::CME::iLink3::Session::messageGrouping method.

The following table shows which thread could fire a particular callback.

CallbackApplication threadHandler's Sending threadHandler's receiving thread
OnixS::CME::iLink3::SessionListener::onError No Yes Yes
OnixS::CME::iLink3::SessionListener::on*(All incoming strongly typed callbacks) No No Yes
OnixS::CME::iLink3::SessionListener::onOutboundApplicationMsg Yes Yes No
OnixS::CME::iLink3::SessionListener::onOutboundSessionMsg Yes Yes No
OnixS::CME::iLink3::SessionListener::onReceivedBytes No No Yes
OnixS::CME::iLink3::SessionListener::onMessageSending Yes Yes


OnixS::CME::iLink3::SessionListener::onStateChange Yes Yes Yes
OnixS::CME::iLink3::SessionListener::onWarning Yes Yes Yes


In OnixS::CME::iLink3::ThreadingModel::ThreadPool mode the Handler creates the thread pool and shares it between all sessions.

The maximum number of threads in the pool is configured via the OnixS::CME::iLink3::SessionSettings::threadPoolSize parameter.


In OnixS::CME::iLink3::ThreadingModel::ExternalThread mode the Handler does not create I/O threads. Such mode means that user creates additional threads on their own (or uses the main thread), then performs event dispatching in a loop by calling OnixS::CME::iLink3::TcpDirectStack::dispatchEvents() routine.

The TCPDirect technology is NOT thread-safe. Therefore, the event dispatching and message sending should be performed from the same thread.
OnixS::CME::iLink3::ThreadingModel::ExternalThread mode is set automatically for TCPDirect connections, regardless of which threading model was specified by SessionSettings. If OnixS::CME::iLink3::ThreadingModel::ExternalThread mode will be set in SessionSettings for non-TCPDirect connections it will cause throwing of exception in Session constructor.
If the OnixS::CME::iLink3::SessionStorageType::AsyncFileBased value is passed to the OnixS::CME::iLink3::Session constructor the Handler creates an addition thread for each Session instance. This thread performs session storage operations.