我正在使用 QuickFIX/N 1.8,当它必须基于 XML 创建 DataDictionary 时,它会失败,因为我的FIX50SP1_TRTN.xml(由 Thomson Reuters 提供)包含一条消息(AllocationReport
)和两个组件(TrdInstrmtLegGrp
,InstrmtLegAllocGrp
),并且两个组件都有具有相同名称 ( NoLegs
- 555
) 的组。
QuickFIX/N 试图为每条消息创建一个字典,包含其所有组件的组,其中每个组的键是 id。因此,它尝试插入密钥555
两次,第二次抛出异常。
System.ArgumentException: '已添加具有相同键的项目。'
\QuickFIXn\DataDictionary\DataDictionary.cs
else if(childNode.Name == "group")
{
DDField fld = FieldsByName[childNode.Attributes["name"].Value];
DDGrp grp = new DDGrp();
XmlAttribute req = childNode.Attributes["required"];
if (req != null && req.Value == "Y"
&& (componentRequired == null || componentRequired.Value == true))
{
ddmap.ReqFields.Add(fld.Tag);
grp.Required = true;
}
if (!ddmap.IsField(fld.Tag))
{
ddmap.Fields.Add(fld.Tag, fld);
}
grp.NumFld = fld.Tag;
parseMsgEl(childNode, grp);
ddmap.Groups.Add(fld.Tag, grp); //########### It fails when the second group is processed ###########
}
我的FIX50SP1_TRTN.xml的摘要内容
<fix major="5" minor="0">
<header/>
<trailer/>
<messages>
<message name="AllocationReport" msgtype="AS" msgcat="app">
<component name="TrdInstrmtLegGrp" required="N"/>
<component name="InstrmtLegAllocGrp" required="N"/>
</message>
</messages>
<components>
<component name="TrdInstrmtLegGrp">
<group name="NoLegs" required="N"> <!-- 555 -->
(content A)
</group>
</component>
<component name="InstrmtLegAllocGrp">
<group name="NoLegs" required="N">
(content B)
</group>
</component>
</components>
<fields>
<field number="555" name="NoLegs" type="NUMINGROUP"/>
</fields>
</fix>
我的问题:
- QuickFIX/N 是否应该支持这种情况?
- 你有没有遇到过这个问题?你是怎么解决的?
- 您是否知道有关这种情况的一些明确约束(在 QuickFIX/N 或 FIX 协议本身中)?(也许有一个明确的限制,即一条消息不能包含多个具有相同名称的组的组件)。