OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
Listening to Session Events

OnixS C++ FIX Engine exposes the OnixS::FIX::ISessionListener class, whose virtual members are called by an instance of the OnixS::FIX::Session class, as response to a particular event occurred during the session life-time.

To be notified about a particular session event, overwrite appropriate member of the OnixS::FIX::ISessionListener class, and supply a descendant instance to the OnixS::FIX::Session's constructor.

The following table describes the meaning of all events, exposed by the OnixS::FIX::Session class in terms of OnixS::FIX::ISessionListener class members.

Method (Event handler)Description
OnixS::FIX::ISessionListener::onInboundApplicationMsgApplication-level message is received from the counterparty.
OnixS::FIX::ISessionListener::onInboundSessionMsgSession-level message is received from the counterparty.
OnixS::FIX::ISessionListener::onOutboundApplicationMsgApplication-level message will be sent to the counterparty. This callback could be used to change fields that are set by the FIX Engine.
OnixS::FIX::ISessionListener::onOutboundSessionMsgSession-level message will be sent to the counterparty. This callback could be used to change the fields that are set by the FIX Engine.
OnixS::FIX::ISessionListener::onReceivedBytesBytes are received from the wire.
OnixS::FIX::ISessionListener::onMessageSendingJust before the FIX message is sent to the wire.
OnixS::FIX::ISessionListener::onResendRequestSent application-level message is about to be resent to the counterparty.
OnixS::FIX::ISessionListener::onResendingStartedResendRequest message is received and the session is about to start resending messages.
OnixS::FIX::ISessionListener::onResendingFinishedResending process is completed.
OnixS::FIX::ISessionListener::onWarningWarning condition is detected.
OnixS::FIX::ISessionListener::onErrorError condition is detected.
OnixS::FIX::ISessionListener::onStateChangeSession state is changed.
Note
Session event handling/listening is synchronous operation. For this reason, it is recommended not to perform time-consuming tasks inside event handlers. For the same reason, it is not recommended to call from the event handler any Session method that could change Session state.

Example

class SessionStateListener : public ISessionListener
{
public:
void onStateChange(SessionState::Enum newState, SessionState::Enum prevState, Session*) ONIXS_FIXENGINE_OVERRIDE
{
std::clog
<< "\nSession's state is changed"
<< ". Previous state was " << SessionState::toString(prevState)
<< ", new state is " << SessionState::toString(newState)
<< std::endl;
}
};