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

wrapAndApplyHeader doesnt respect constant fields in the MessageHeader #602

Closed
kdkavanagh opened this issue Oct 9, 2018 · 1 comment
Closed

Comments

@kdkavanagh
Copy link

I don't have a need for schemaID in the MessageHeader and have set it to a constant in the XML. This runs through the sbe-tool without complaints, however the generated wrapAndApplyHeader methods still try to apply the schemaID, ignoring the fact that it is a constant.

XML:

    <composite name="messageHeader" description="Message identifiers and length of message root">
        <type name="msgSize" primitiveType="uint16"/>
        <type name="templateId" primitiveType="uint16"/>
        <type name="version" primitiveType="uint16"/>
        <type name="blockLength" primitiveType="uint16"/>
        <type name="schemaId" primitiveType="uint16" presence="constant">1</type>
    </composite>

Generated java:

    public TestFixedWidthMessageEncoder 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);
    }
@mjpt777
Copy link
Contributor

mjpt777 commented Oct 10, 2018

This will break the spec in that the header has to have those minimum 4 fields on the wire.

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

2 participants