• Programming Guide
  • Api Documentation
  • OnixS CME iLink3 Handler for .NET Core, version 1.4.2
Show / Hide Table of Contents
  • Introduction
  • System Requirements
  • Getting Started
    • Error Reporting
    • Licensing
    • SBE Message
      • Tag-based Messaging
      • Message Fields
      • Repeating Groups
    • iLink 3 Session
      • Universally Unique Identifier
      • Establishing iLink3 Connection
      • Exchanging Messages
      • Message Sequence Numbers
  • Configuring the Handler
    • Configuration File Examples (XML or JSON)
  • Logging
  • Session Storage
    • File-Based Session Storage
    • Memory-based Session Storage
    • Asynchronous File-Based Session Storage
    • Pluggable Session Storage
  • Advanced Programming
    • Thread Safety
    • Session Initialization and Binding
    • Session States
    • Listening to Session Events
    • Handling NotApplied Messages
    • Handling Business Reject Messages
    • Automated Downloading of GTC and GTD Orders
    • Reconnection
    • Fault Tolerance
    • Understanding Send Latency
    • Strongly Typed Messages
  • Best Practices
    • Low Latency Best Practices
  • Glossary
  • Support

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 ISessionStorage interface.

Implementing Pluggable Storage

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

  • The user should manage the lifecycle of the storage. The Handler treats the instance of a Pluggable Storage as a "foreign" object and never attempts to delete it. On the other hand, there is a strong requirement to keep storage instance valid until the Session instance is destroyed.

  • Be as fast as possible. The Pluggable Storage is a part of the message send/receive path, so it has a direct effect on the sending/receiving latency and overall throughput of the system.

  • Avoid throwing exceptions. Exceptions thrown from Pluggable Storage callbacks immediately break a session.

  • Don't make assumptions about the parameters' lifecycle. Whenever you need to keep such data for separate usage, you should make copies of messages or memory blocks and store them in an appropriate place, but don't keep references, passed to events.

  • No synchronization is required. The Handler manages all synchronization issues, so all methods of Pluggable Storage are called sequentially.

  • Track message numbers when the message is logged. Message sequence numbers should be tracked while messages are logged, i.e. during <xref:OnixS.Cme.ILink3.Storage.ISessionStorage.StoreInboundMessage(System.ReadOnlySpan{System.Byte},System.Int32,System.Boolean)> or <xref:OnixS.Cme.ILink3.Storage.ISessionStorage.StoreOutboundMessage(System.ReadOnlySpan{System.Byte},System.Int32,System.Boolean,System.Boolean,System.DateTime)> methods. These numbers should be kept and returned to the Handler through InSeqNum and OutSeqNum calls.

Call Order of Pluggable Storage Methods

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

Incoming message handling

  • When there is a session-level message, the following methods are called:
    • <xref:OnixS.Cme.ILink3.Storage.ISessionStorage.StoreInboundMessage(System.ReadOnlySpan{System.Byte},System.Int32,System.Boolean)>.
    • InboundSessionMessage event, if subscribed.
  • When there is an application-level message, the call order is reversed:
    • InboundApplicationMessage event, if subscribed.
    • <xref:OnixS.Cme.ILink3.Storage.ISessionStorage.StoreInboundMessage(System.ReadOnlySpan{System.Byte},System.Int32,System.Boolean)>.

If the user's code throws an exception on any stage, the session becomes disconnected, and subsequent steps are omitted.

Outgoing message handling

  • OutboundSessionMessage or OutboundApplicationMessage events, if subscribed.
  • <xref:OnixS.Cme.ILink3.Storage.ISessionStorage.StoreOutboundMessage(System.ReadOnlySpan{System.Byte},System.Int32,System.Boolean,System.Boolean,System.DateTime)>.

Example

SessionSettings settings = new SessionSettings();

using (Session session = new Session(settings, marketSegmentId, new MySessionStorage())) // MySessionStorage implements ISessionStorage
{
}
In This Article
Back to top Copyright © Onix Solutions.
Generated by DocFX