• 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

Strongly Typed Messages

By default, SBE messages and repeating groups can be accessed in Session callbacks via the general <xref:OnixS.SimpleBinaryEncoding.IFieldSet> interface. Also, there is a tool that allows generating an assembly with pre-generated strongly typed messages.

IFieldSet style code

int securityId = report.GetInteger(Tag.SecurityID);
string clOrdID = report.GetString(Tag.ClOrdID);
decimal price = report.GetDecimal(Tag.Price);

Strongly typed messages code

int securityId = report.SecurityID;
string clOrdID = report.ClOrdID;
decimal price = report.Price;
Note

Please note that strongly typed messages assembly should be generated each time when templates file is changed. Also, code, which depends on this assembly, should be rebuilt.

Using strongly typed messages

There are several steps that should be completed to use strongly typed messages:

  • Generate strongly typed messages assembly with the tool, which is placed under the tools/sbe-decoder-generator folder of the installation package:

dotnet OnixS.SimpleBinaryEncoding.CodeGenerator.dll

Note

Please do not forget to place the actual templates file in the folder where this tool is located.

  • Add a reference to the generated OnixS.SimpleBinaryEncoding.Cme.dll to your project.

  • Set the Handler to load generated library:

settings.LoadDecoderLibrary = true;
  • Create typed message object, set its fields, and send it:
NewOrderSingle514 order = new NewOrderSingle514();
order.SecurityID = securityId;
order.ClOrdID = clOrdId;
order.Price = price;
session.Send(order);
  • Use template id to cast <xref:OnixS.SimpleBinaryEncoding.IMessage> to the required message type in callback:
if (e.Message.TemplateID == 522)
{
    ExecutionReportNew522 report = (ExecutionReportNew522)e.Message;
}
  • Use properties of the strongly typed message:
int securityId = report.SecurityID;
string clOrdID = report.ClOrdID;
decimal price = report.Price;

Sample

The sample, located at samples/TypedMessages is a good starting point.

In This Article
Back to top Copyright © Onix Solutions.
Generated by DocFX