OnixS C++ B3 BOE Binary Order Entry  1.2.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::B3::BOE::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 override;
UInt64 sessionVerId() const override;
void sessionVerId(UInt64 value) override;
SeqNumber inSeqNum() const override;
void inSeqNum(SeqNumber msgSeqNum) override;
SeqNumber outSeqNum() const override;
void outSeqNum(SeqNumber msgSeqNum) override;
bool negotiated() const override;
void negotiated(bool status) override;
Timestamp sessionCreationTime() const override;
void sessionCreationTime(Timestamp) override;
void close(bool doBackup = false) override;
void storeInboundMessage(const NetworkMessage& message, SeqNumber msgSeqNum, Timestamp messageReceivingUtcTimestamp = Timestamp()) override;
void storeOutboundMessage(const NetworkMessage& message, SeqNumber msgSeqNum, Timestamp messageSendingUtcTimestamp = Timestamp()) override;
void flush() override;
void warmup(size_t messageSize, Timestamp ts) override;
};
};
void pluggableStorage()
{
SessionSettings sessionSettings;
MySessionStorage myStorage;
Session session(sessionSettings, nullptr, SessionStorageType::Pluggable, &myStorage);
}
See also
Pluggable Storage Sample