You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
quickfixgo quickfix.Message.Body.Set not work #702
Activity
dablelv commentedon Mar 13, 2025
找到原因了。
quickfix.Message 的 String() 方法实现如下:
从您提供的 quickfix.Message 的 String() 方法的实现来看,当 m.rawMessage 不为空时,方法直接返回 rawMessage.String()。这种实现意味着它会返回消息创建时的原始字符串,而不是反映任何后续修改的版本。如果在消息被创建之后对其进行了修改(如设置新的字段值),这些修改则不会反映在通过 String() 方法得到的字符串中。
建议修改 quickfix 库的源代码,您可以调整 String() 方法的行为,使其在每次调用时都重新构建消息字符串,或者添加一个新的方法来支持这种行为。例如:
这种方法确保了无论 rawMessage 的状态如何,都会返回一个包含所有当前修改的新字符串。