The handler supports the following threading models: OnixS::CME::ConflatedTCP::ThreadingModel::DedicatedThreads and OnixS::CME::ConflatedTCP::ThreadingModel::ThreadPool.
The model is configured via the OnixS::CME::ConflatedTCP::SessionSettings::threadingModel(ThreadingModel::Enum value) method.
In OnixS::CME::ConflatedTCP::ThreadingModel::DedicatedThreads mode the Handler creates a dedicated receiving thread and a dedicated sending thread for each OnixS::CME::ConflatedTCP::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::ConflatedTCP::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::ConflatedTCP::Session::messageGrouping method.
The following table shows which thread could fire a particular callback.
Callback | Application thread | Handler's Sending thread | Handler's receiving thread |
OnixS::CME::ConflatedTCP::SessionListener::onError | No | Yes | Yes |
OnixS::CME::ConflatedTCP::SessionListener::on*(All incoming strongly typed callbacks) | No | No | Yes |
OnixS::CME::ConflatedTCP::SessionListener::onOutboundApplicationMsg | Yes | Yes | No |
OnixS::CME::ConflatedTCP::SessionListener::onOutboundSessionMsg | Yes | Yes | No |
OnixS::CME::ConflatedTCP::SessionListener::onReceivedBytes | No | No | Yes |
OnixS::CME::ConflatedTCP::SessionListener::onMessageSending | Yes | Yes | No |
OnixS::CME::ConflatedTCP::SessionListener::onStateChange | Yes | Yes | Yes |
OnixS::CME::ConflatedTCP::SessionListener::onWarning | Yes | Yes | Yes |
In OnixS::CME::ConflatedTCP::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::ConflatedTCP::SessionSettings::threadPoolSize parameter.
Session
instance. This thread performs session storage operations.