OnixS C++ FIX Engine  4.4.0
API Documentation
Pluggable Session Storage

Pluggable session storage is the storage which implemented by the user. For example, it could be used to implement High-Availability (HA) Solutions. One can implement a Pluggable Session Storage, which stores data to shareable storage. If one server with the FIX Engine fails and another reserve server stands up, the FIX Engine can restore session states from the same shareable storage. Such storage should implement the OnixS::FIX::ISessionStorage interface.

Implementing Pluggable Storage

There are few basic rules that should be applied to the implementation of Pluggable Storage.

Call Order of Pluggable Storage Methods

This section explains how different methods of Pluggable Storage are called in different situations.

Incoming message handling

If an exception is thrown by the user's code on any stage (during ISessionStorage or ISessionListener handling), the session becomes disconnected, and subsequent stages are omitted. Logout message will be sent to the counterparty in dependency on the value of the OnixS::FIX::EngineSettings::sendLogoutOnException setting.

Outgoing message handling

Resend Request handling

Attaching Pluggable Storage

There is a quite schematic illustration for the pluggable storage usage.

// Declare the own class and implement ISessionStorage interface callbacks.
class MyPluggableStorage : public OnixS::FIX::ISessionStorage
void close(bool /*keepSequenceNumbers*/, bool /*doBackup*/) ONIXS_FIXENGINE_OVERRIDE {}
void getOutbound(SequenceNumber /*beginSequenceNumber*/, SequenceNumber /*endSequenceNumber*/, ISessionStorageListener * /*listener*/) ONIXS_FIXENGINE_OVERRIDE {}
SequenceNumber inSeqNum() ONIXS_FIXENGINE_OVERRIDE { return 0; }
void inSeqNum(SequenceNumber /*messageSequenceNumber*/) ONIXS_FIXENGINE_OVERRIDE {}
void storeInbound(SequenceNumber /*messageSequenceNumber*/, const RawMessagePointer & /*pointer*/, bool /*logMessage*/) ONIXS_FIXENGINE_OVERRIDE {}
void storeOutbound(const Message &, const RawMessagePointer & /*pointer*/, bool /*logMessage*/) ONIXS_FIXENGINE_OVERRIDE {}
void storeOutbound(const SerializedMessage &, SequenceNumber /*sequenceNumber*/, const RawMessagePointer & /*pointer*/, bool /*logMessage*/) ONIXS_FIXENGINE_OVERRIDE {}
void setSessionTerminationFlag(bool /*terminated*/) ONIXS_FIXENGINE_OVERRIDE {}
SequenceNumber outSeqNum() ONIXS_FIXENGINE_OVERRIDE { return 0; }
void outSeqNum(SequenceNumber /*messageSequenceNumber*/) ONIXS_FIXENGINE_OVERRIDE {}
void sessionCreationTime(Timestamp) ONIXS_FIXENGINE_OVERRIDE {}
Timestamp sessionCreationTime() ONIXS_FIXENGINE_OVERRIDE { return Timestamp(); }
int resendingQueueSize() const ONIXS_FIXENGINE_OVERRIDE { return -1; }
void resendingQueueSize(int) ONIXS_FIXENGINE_OVERRIDE {}
// Declare the instance of the storage.
MyPluggableStorage myStorage;
// Create the session which uses the storage.
Session initiator("SenderCompId", "TargetCompId", ProtocolVersion::FIX_42, &listener, SessionStorageType::Pluggable, &myStorage);


Please, check the PluggableStorage sample included in the distribution package of the FIX Engine.