Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
szymonwieloch opened this issue Jan 1, 2025 · 0 comments
Open

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

szymonwieloch opened this issue Jan 1, 2025 · 0 comments

Comments

@szymonwieloch
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant