The Lab

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 1.4.12

Table of Contents

SBE

What tool should be used to generate stubs from  schema?

MarketFactory recommends using the RealLogic SBETool. It should be noted that we use v1.25.1 to avoid a bug in the CME ilink3 schema that is revealed with later versions of the tool, but clients are free to use later versions.

The breaking change was introduced in SBE Tool v1.25.2, as described in RealLogic issues #889 and #917:  because it is impossible to specify a character value of 0x00 in a valid XML document, the proposed solution, such as it is, is to convince CME to remove the null_value="0" attribute from the specification of charNULL in their schema.  This may take a while.

Why does the wire representation of a message appear different to that defined in the schema?

When directly inspecting "on-the-wire" representations of char datatypes - including enumerations which may take numeric values - be aware that these are subject to UTF-8 encoding, and you may be inspecting the decimal code of the given character.

Refer to https://en.wikipedia.org/wiki/UTF-8#Codepage_layout for details.

Code Block
languagexml
titleExample
<enum name="Side" description="Side" encodingType="char">
    <validValue name="Buy">1</validValue>
    <validValue name="Sell">2</validValue>
    <validValue name="TwoWay">7</validValue>
</enum>

You may observe the following values:

  • 49 - '1' - Buy
  • 55 - '2' - Sell
  • 55 - '7' - TwoWay

When I parse/write a string from/to a fixed length SBE field,

...

how

...

do I determine/signal where to truncate

...

?

The string with either be null-terminated or will be of the size of the fixed length field. So if the string is smaller than the field length; it will end with a \0. If the string is the same length as the field length then there is no terminator. 
When writing you do not have to ensure the remainder of the array is all \0 values - although that would work. The string just needs to be terminated with a single \0; or if the string is exactly as large as the field length - you don't need to do anything.

...

In addition, SBE is a performance-oriented wire protocol. If checksums are included as for the FIX protocol, application-level checksum computation becomes a significant component of the overall cost.


Is there no way to define groups once rather than have them repeatedly defined for each message type that uses them in the SBE schema?

...

 

Unlike FIXML, there is no definition of an attributeGroup component that is defined once and referenced multiple times (e.g. in a complexType). In SBE each group has to be an explicit component of it's parent group or message. To minimise the amount of 'duplicate' code, there are two broad avenues to consider:

...