By default, the Handler uses File-Based Session Storage, so it stores incoming and outgoing messages and session's state data in files in the OnixS::B3::BOE::SessionSettings::storageDirectory folder.
However, it is possible to keep all session-related data in memory using the Memory-based Session Storage.
Also, one can use asynchronous-file-based-session-storage, which combines excellent performance with the File-Based Session Storage functionality.
Yet another option is to use the Pluggable Session Storage.
When the OnixS::B3::BOE::Session object is created, the session state (OnixS::B3::BOE::Session::sessionVerId, OnixS::B3::BOE::Session::negotiated, OnixS::B3::BOE::Session::inSeqNum, OnixS::B3::BOE::Session::outSeqNum, etc.) is restored from the session storage.
To start a session as a new one (so-called "clean start"), either remove the session storage files from the previous runs or call the OnixS::B3::BOE::Session::reset() method.
When the session is finished, the session storage files are not needed anymore. They can be backed up, and later a new FIXP session with a new SessionVerID will start message sequence numbers from 1.
The usual practice is to back up log files at the end of the business day (so-called "End Of Day procedure") to generate a new Session Version Identification (sessionVerId) and start the sequence numbers from 1 at the beginning of the next trading day.
If the session storage files are lost, the session state should be restored from scratch. In this case, the B3 exchange still keeps the actual session state, including the current SessionVerID and message sequence numbers, while the client session starts with the default values. Therefore, the session cannot be connected in the usual way after the storage loss. The exchange rejects the initial connection attempt and returns the actual session state values that must be used for the next connection attempt.
The easiest way to do this is to catch exceptions thrown by the OnixS::B3::BOE::Session::connect method and update the session parameters according to the information returned by the exchange.