quickfixgo / quickfix

The Go FIX Protocol Library :rocket:
https://www.quickfixgo.org/
Other
723 stars 282 forks source link

Preserve original body when resending #624

Closed mgatny closed 3 months ago

mgatny commented 3 months ago

refs #608 #568

This is a workaround for the fact that we currently rely on the generated Message types to properly serialize/deserialize RepeatingGroups.

In other words, we cannot go from bytes to a Message then back to bytes, which is exactly what we need to do in the case of a Resend.

This adds the Message.buildWithBodyBytes([]byte) func that lets us pull the Message from the Store, parse it, update the Header, and then build it back into bytes using the original Body.

Stay tuned for a more complete solution that fully solves the problem beyond just Resend.

Note: The only standard non-Body group is NoHops. If that is used in the Header, this workaround may fail.