简体   繁体   English

在QuoteRequest消息中设置SenderSubID的最佳方法是什么?

[英]What is the best way to setup SenderSubID in QuoteRequest Message?

I am developing on quickfixj 我正在使用quickfixj开发

Trying to set the SenderSubID Field in the header of QuoteRequest message. 试图在QuoteRequest消息的标题中设置SenderSubID字段。

I use the following code: 我使用以下代码:

QuoteRequest msg = new QuoteRequest();
msg.getHeader().set(new SenderSubID(myid));

Is this the best way or is there any better way to do this? 这是最好的方法还是有更好的方法呢? Thanks 谢谢

I'm not sure if getHeader() allows you to use set() . 我不确定getHeader()允许您使用set() If it does, use it. 如果是这样,请使用它。 Otherwise simply use setField() . 否则,只需使用setField()

Message.set() is most of the time the safest way to add new fields to messages, because the compiler prevents you from adding fields that are not a part of a certain MsgType (based on the FIX xx specs). 大多数情况下, Message.set()是向消息中添加新字段的最安全方法,因为编译器会阻止您添加不属于某些MsgType的字段(基于FIX xx规范)。

Refer to this online documentation for QuickfixJ. 有关QuickfixJ,请参阅在线文档。 Will save you a lot of trouble. 将为您省去很多麻烦。

The Header class which you return from getHeader() doesn't support a set function. getHeader()返回的Header类不支持set函数。 But has 2 set functons which can work for you. 但是有2套功能可以为您工作。

setString 

More flexible, but you may add in fields which aren't supported in the FIX standards and which would get rejected from the client at a later stage. 更加灵活,但是您可以添加FIX标准不支持的字段,这些字段稍后会被客户端拒绝。

setField  

Safest way to create a message, would generate errors the moment you try to add a non existent field in a message. 创建消息的最安全方法是,当您尝试在消息中添加不存在的字段时会产生错误。 But this mayn't be a foolproof method, if you are playing around with xml file which QuickfixJ uses to check against fields present/not present in a message. 但这不是万无一失的方法,如果您正在使用xml文件,QuickfixJ会使用它来检查消息中存在/不存在的字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM