OnixS C++ CME MDP Conflated TCP Handler  1.1.0
API Documentation
Pluggable Session Storage

Pluggable session storage is the storage implemented by the user.

For example, it could be used to implement High-Availability (HA) Solutions:

One can implement a Pluggable Session Storage that stores data to shared storage. If one server fails and another reserve server activates, the Handler can restore session states from the shared storage.

Such storage should implement the OnixS::CME::ConflatedTCP::SessionStorage interface.

Implementing Pluggable Storage

There are a 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 the user's code throws an exception on any stage, the session becomes disconnected, and subsequent steps are omitted.

Outgoing message handling

Example

class MySessionStorage : public SessionStorage
{
public:
MySessionStorage();
const std::string& id() const ONIXS_CONFLATEDTCP_OVERRIDE;
void uuid(UInt64 value) ONIXS_CONFLATEDTCP_OVERRIDE;
UInt64 previousUuid() const ONIXS_CONFLATEDTCP_OVERRIDE;
void previousUuid(UInt64 value) ONIXS_CONFLATEDTCP_OVERRIDE;
SeqNumber inSeqNum() const ONIXS_CONFLATEDTCP_OVERRIDE;
void inSeqNum(SeqNumber msgSeqNum) ONIXS_CONFLATEDTCP_OVERRIDE;
SeqNumber previousSeqNum() const ONIXS_CONFLATEDTCP_OVERRIDE;
void previousSeqNum(SeqNumber msgSeqNum) ONIXS_CONFLATEDTCP_OVERRIDE;
SeqNumber outSeqNum() const ONIXS_CONFLATEDTCP_OVERRIDE;
void outSeqNum(SeqNumber msgSeqNum) ONIXS_CONFLATEDTCP_OVERRIDE;
bool terminated() const ONIXS_CONFLATEDTCP_OVERRIDE;
void terminated(bool status) ONIXS_CONFLATEDTCP_OVERRIDE;
Timestamp sessionCreationTime() const ONIXS_CONFLATEDTCP_OVERRIDE;
void sessionCreationTime(Timestamp) ONIXS_CONFLATEDTCP_OVERRIDE;
void clear() ONIXS_CONFLATEDTCP_OVERRIDE;
void close(bool terminate = false, bool doBackup = false) ONIXS_CONFLATEDTCP_OVERRIDE;
void storeInboundMessage(const RawMessagePointer& rawMsg, SeqNumber msgSeqNum, bool isOriginal, Timestamp messageReceivingUtcTimestamp = Timestamp()) ONIXS_CONFLATEDTCP_OVERRIDE;
void storeOutboundMessage(const RawMessagePointer& rawMsg, SeqNumber msgSeqNum, bool isOriginal = true, bool warmUp = false, Timestamp messageSendingUtcTimestamp = Timestamp()) ONIXS_CONFLATEDTCP_OVERRIDE;
void flush() ONIXS_CONFLATEDTCP_OVERRIDE;
};
};
void pluggableStorage()
{
SessionSettings sessionSettings;
int MarketSegmentId = 0;
MySessionStorage myStorage;
Session session(sessionSettings, MarketSegmentId, ONIXS_CONFLATEDTCP_NULLPTR, ONIXS_CONFLATEDTCP_NULLPTR, SessionStorageType::Pluggable, &myStorage);
}
See also
the "PluggableStorage" sample from the distribution package.