• Programming Guide
  • Api Documentation
  • OnixS .NET Core CME Market Data Handler, version 4.2.2
Show / Hide Table of Contents
  • Introduction
  • System Requirements
  • Getting Started
    • Licensing
    • Error Reporting
    • Configuration Files
    • Handler Events
    • Logging
  • Advanced Programming
    • Security Filtering
    • Best Bid-Offer Tracking
    • Security Definitions Cache
    • Strongly Typed Messages
    • Replaying Log Files
  • Low Latency Best Practices
  • Troubleshooting
  • FAQ
  • Support
  • External Resources

Strongly Typed Messages

By default SBE messages and repeating groups can be accessed in Handler callbacks via general IFieldSet interface. Also, there is a tool which allows generating an assembly with pre-generated strongly typed messages.

IFieldSet style code

int securityId = securityDefinition.DefinitionMessage.GetInteger(Tags.SecurityID);
string symbol = securityDefinition.DefinitionMessage.GetString(Tags.Symbol);
int contractMultiplier = securityDefinition.DefinitionMessage.GetInteger(Tags.ContractMultiplier);

Strongly typed messages code

int securityId = definition.SecurityID;
string symbol = definition.Symbol;
int contractMultiplier = definition.ContractMultiplier;
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 rebuilded.

Using strongly typed messages

There are several steps which 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:

OnixS.SimpleBinaryEncoding.DecoderGenerator.exe

Note

Please do not forget to place actual templates file to 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:

handler.LoadDecoderLibrary = true;
  • Use template id to cast IMessage to the required message type:
if (securityDefinition.DefinitionMessage.TemplateID == 27)
{
    MDInstrumentDefinitionFuture27 definition = (MDInstrumentDefinitionFuture27)securityDefinition.DefinitionMessage;
}
  • Use properties of the strongly typed message:
int securityId = definition.SecurityID;
string symbol = definition.Symbol;
int contractMultiplier = definition.ContractMultiplier;
In This Article
Back to top Copyright © Onix Solutions.
Generated by DocFX