Skip to content

numGroups / numVarDataFields support (SBE spec v2) #1034

@estaban

Description

@estaban

The 1.0 specification mentions that the following attributes are part of message headers

Number of repeating groups
A count of repeating groups at the root level of the message. The count does not include nested repeating groups.

Number of variable-length fields
A count of the variable-length fields at the root level of the message. The count does not include variable-length fields within repeating groups.

When generating Java encoder/decoder for this schema using 1.33, numGroups and numVarDataFields do not seem to have any special significance.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sbe:messageSchema xmlns:sbe="http://fixprotocol.io/2016/sbe"
                   package="uk.co.real_logic.sbe.benchmarks"
                   id="1"
                   version="1"
                   semanticVersion="5.2"
                   description="Example schema"
                   byteOrder="littleEndian">
    <types>
        <composite name="messageHeader" description="Message identifiers 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>
    </types>

    <sbe:message name="Car" id="1" description="Description of a basic Car">
        <field name="serialNumber" id="1" type="uint32"/>
    </sbe:message>
</sbe:messageSchema>

Generated Java code:

    public CarEncoder wrapAndApplyHeader(
        final MutableDirectBuffer buffer, final int offset, final MessageHeaderEncoder headerEncoder)
    {
        headerEncoder
            .wrap(buffer, offset)
            .blockLength(BLOCK_LENGTH)
            .templateId(TEMPLATE_ID)
            .schemaId(SCHEMA_ID)
            .version(SCHEMA_VERSION);

        return wrap(buffer, offset + MessageHeaderEncoder.ENCODED_LENGTH);
    }

Are numGroups / numVarDataFields not supported ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Blocked by SBE v2 specThe task is blocked by another task or upstream project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions