The OnixS C++ FIX Engine exposes OnixS::FIX::ISessionListener class whose virtual members are called by an instance of OnixS::FIX::Session class as response to a particular event occurred during session life-time.
To be notified about particular session event overwrite appropriate member of OnixS::FIX::ISessionListener class and supply descendant instance to OnixS::FIX::Session's constructor.
The following table describes the meaning of all events exposed by the OnixS::FIX::Session class in terms of of OnixS::FIX::ISessionListener class members.
Method (Event handler) | Description |
---|---|
OnixS::FIX::ISessionListener::onStateChange | Session state is changed. |
OnixS::FIX::ISessionListener::onError | Error condition is detected. |
OnixS::FIX::ISessionListener::onInboundApplicationMsg | Application-level message is received from the counterparty. |
OnixS::FIX::ISessionListener::onInboundSessionMsg | Session-level message is received from the counterparty. |
OnixS::FIX::ISessionListener::onOutboundApplicationMsg | Application-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::onOutboundSessionMsg | Session-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::onResendRequest | Sent application-level message is about to be resent to the counterparty. |
OnixS::FIX::ISessionListener::onWarning | Warning condition is detected. |
class SessionStateListener : public ISessionListener { public: virtual void Listener::onStateChange( Session::State newState, Session::State prevState, Session* sn) { std::clog << "\nSession's state is changed" << ". Previous state was " << Session::state2string(prevState) << ", new state is " << Session::state2string(newState) << std::endl; } };