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

Migrate mqbcmd away from XSD code generation #615

Open
pniedzielski opened this issue Feb 14, 2025 · 1 comment
Open

Migrate mqbcmd away from XSD code generation #615

pniedzielski opened this issue Feb 14, 2025 · 1 comment

Comments

@pniedzielski
Copy link
Collaborator

Types for representing admin commands in BlazingMQ are generated from an XSD
file mqbcmd.xsd, which outputs mqbcmd_messages.h. There are a number of
issues with this approach for us:

  1. The tool to do this code generation is not open-source, and so we are not
    able to accept patches that add or change admin commands.

  2. Doxygen does not understand the documentation generated in
    mqbcmd_messages.h, and any modifications we do will be overwritten the
    next time we regenerate the file.

Furthermore, unlike other places where we use XSD code generation in BlazingMQ,
which also suffer from the same downsides, we do not gain any major benefits of
it in mqbcmd, as we do not serialize or deserialize the admin commands in any
structured way.

All of this, coupled with how relatively small this XSD, make it a good
candidate to convert to non-generated code. This may be as simple as removing
the XSD, blessing the current generated types as the source of truth, and
converting the existing documentation over.

@678098
Copy link
Collaborator

678098 commented Feb 19, 2025

This may be as simple as removing the XSD, blessing the current generated types as the source of truth, and converting the existing documentation over.

The schema autogeneration tool converts this:
mqbcmd.xsd: 1161 lines

Into this:
mqbcmd_messages.h: 54236 lines
mqbcmd_messages.cpp: 30740 lines

.xsd file contains possibly the minimal representation of a protocol. It's convenient and fast to make changes. Also, we don't really need to think too much about functions/operators defined in autogenerated code, because we have expectations how it's done in general.

If we go away from code generation from .xsd, it's another story: we will have to consider and look after all trivial operator changes in protocol definition sources, we will have to make changes in a file of scale 54k/30k lines. Working directly with these files will not only be error-prone, but will also require a lot of effort to make changes at a huge scale. I think it will quickly become unbearable.

I think in terms of a long-term effort the best way is to write our own open-source converter. Alternatively, we can postpone this problem until we have a strong demand to solve it.

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