[Quickfix-developers] Efficient Message creation
Brought to you by:
orenmnero
From: Mike P. <mic...@ya...> - 2008-04-24 17:05:19
|
If I have a raw FIX string what is the most efficient method for creating a Message object out of it using the Java API? The way I was doing it was this: // Have to do this to get the 'BeginString' and 'MsgType' fields // I guess I could do some manual field checking/lookup Message fixmsg = new Message(fixmsgstr); String beginString = fixmsg.getHeader().getString(BeginString.FIELD); String fixMsgType = fixmsg.getHeader().getString(MsgType.FIELD); // m_messageFactory is an instance of the DefaultMessageFactory // This returns the FIX version specific message m_messageFactory.create(beginString, fixMsgType); fixmsg.initFromString(fixmsgstr, true); The problem with the way I doing it is that the raw FIX message string gets parsed twice. I need the FIX version specific Message object so when I call the crack() method the MessageCracker() can determine the version specific method to call. I'm getting a ClassCastException right now. Is there another way to do this? 'This' being create a version specific Message object from a raw message string. Thanks, Mike ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |