I am developing on quickfixj
Trying to set the SenderSubID Field in the header of QuoteRequest message.
I use the following cod开发者_Go百科e:
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
Refer to this online documentation for QuickfixJ. Will save you a lot of trouble.
The Header class which you return from getHeader() doesn't support a set function. But has 2 set functons which can work for you.
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.
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.
I'm not sure if getHeader()
allows you to use set()
. If it does, use it.
Otherwise simply use 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 x.x specs).
精彩评论