Skip to content

Problems with multiple protocols sent over the same wire. #1042

Open
@szymonwieloch

Description

@szymonwieloch

In our company we send multiple SBE protocols over the same wire. This can be done because our message header contains the schemaId and we are able to distinguish between different schemas. However we do have some issues with the API, at least with C++ (I don't know APIs of other languages).

schemaId may not be the first field.

Different schemas may have different message headers with different order of fields and with possible extra fields. To be able to distinguish them you should:

  1. First read the schema ID of the received message
  2. Parse header using the correct message header type.

To achieve that:

  1. The schemaId field needs to be of the same size - this is indeed recommended (uint16)
  2. The schemaId field needs to be at the same offset in all schemas. The obvious position should be 0. This unfortunately is not done. Not only the code generator does not warn you about placing this field somewhere later inside the schema, but the official documentation shows bad examples:

https://www.fixtrading.org/standards/sbe-online/

<composite name="messageHeader" description="Template ID and length of message root">
    <type name="blockLength" primitiveType="uint16"/>
    <type name="templateId" primitiveType="uint16"/>
    <type name="schemaId" primitiveType="uint16"/>
    <type name="version" primitiveType="uint16"/>
    <type name="numGroups" primitiveType="uint16" />
    <type name="numVarDataFields" primitiveType="uint16" />
</composite>

No way to parse only the schemaId

The generated code should provide some function to parse only the schemaId field without parsing the whole header since it is unknown which header type should be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions