Re: [Quickfix-developers] Raw message data
Brought to you by:
orenmnero
From: George H. <ge...@so...> - 2009-10-16 01:16:53
|
Andrei, Thank you for the quick and very helpful reply. Just as you said, "QuickFIX::Message.toString()" did the trick. Here is my test code to get a string from a message and back again: 52 void Application::fromApp( const FIX::Message& message, const FIX::SessionID& sessionID ) 53 throw( FIX::FieldNotFound, FIX::IncorrectDataFormat, FIX::IncorrectTagValue, FIX::UnsupportedMessageType ) 54 { 55 struct timeval tv; 56 struct timezone tz; 57 struct tm *tm; 58 std::string RawMessage; 59 std::string RawMessageXL; 60 61 FIX::MsgType msgtype; 62 FIX::Message quickFixMessage; 63 64 crack( message, sessionID ); 65 message.getHeader().getField( msgtype ); 66 67 gettimeofday(&tv, &tz); 68 tm=localtime(&tv.tv_sec); 69 myLog(VERBOSE_L1, "Ticket Incoming: %d:%02d:%02d.%d\n", tm- >tm_hour, tm->tm_min, tm->tm_sec, (int)tv.tv_usec); 70 71 // 72 // 73 // Here is the "message" -> string -> "message" again 74 // 75 message.toString(RawMessage); 76 77 myLogV(VERBOSE_L2, "MSG Type: %s\n", msgtype); 78 myLog(VERBOSE_L2, "Incoming Data:\n\t\t%s\n", RawMessage.c_str()); 79 // 80 // 81 // 82 FIX::Session* pSession = FIX::Session::lookupSession( sessionID ); 83 FIX::DataDictionary dict; 84 dict = pSession->getDataDictionary(); 85 try 86 { 87 quickFixMessage = FIX::Message( RawMessage, dict ); 88 } 89 catch ( std::exception & e ) 90 { 91 myLogV(ALWAYS_PRINT, "\"fromApp\" Exception: %s \n", e.what()); 92 } 93 myLogV(ALWAYS_PRINT, "\"XLData\":\n\t\t%s\n", quickFixMessage); ... ... You might as why bother? Well, with the outgoing messages in their original format (in a file) I can replay/resend a bunch of messages (in case of problems). Again, many thanks, George On Oct 15, 2009, at 3:02 PM, Andrei Goldchleger wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > On Thu, Oct 15, 2009 at 1:43 PM, George Hrysanthopoulos > <ge...@so...> wrote: >> QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html >> QuickFIX Support: http://www.quickfixengine.org/services.html >> >> Hello everyone, >> >> Quick question: >> >> From my acceptor app, I want to get the raw data stream for a >> message >> (session or otherwise) >> including all field separators (0x01), etc. >> >> I want to dump this to a file later. >> >> How do I get this raw message? >> >> Many thanks, >> >> George Hrysanthopoulos > > Use the QuickFIX::Message.toString() in the fromApp() and fromAdmin() > callbacks. > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers |