RE: [Quickfix-developers] Message.getHeader
Brought to you by:
orenmnero
|
From: Shankar K. <skr...@jw...> - 2006-02-03 13:19:42
|
Thanks, it wasn't the typo that was the issue, However, I should have implemented it the way you suggested(type safe way) Have changed it, thanks for your time. Tks _____ From: Shepheard, Toby (London) [mailto:Tob...@ml...] Sent: Friday, February 03, 2006 4:56 AM To: Shankar Krishnan; qui...@li... Subject: RE: [Quickfix-developers] Message.getHeader Shankar, I'd suggest you use the more type-safe method recommended in the documentation (http://www.quickfixengine.org/quickfix/doc/html/receiving_messages.html <http://www.quickfixengine.org/quickfix/doc/html/receiving_messages.html> ) This takes the following form: using QuickFix; public void fromApp(Message message, SessionID sessionID) { crack(message, sessionID); } public override void onMessage(QuickFix42.NewOrderSingle message, QuickFix.SessionID sessionID) { ClOrdID clOrdID = new ClOrdID; message.get(clOrdID); ClearingAccount clearingAccount = new ClearingAccount(); message.get(clearingAccount); } public override void onMessage(QuickFix42.OrderCancelRequest message, QuickFix.SessionID sessionID) { ClOrdID clOrdID = new ClOrdID; message.get(clOrdID); // compile time error!! field not defined for OrderCancelRequest ClearingAccount clearingAccount = new ClearingAccount(); message.get(clearingAccount); } All you need to do is add your own onMessage method that takes an execution report message type and the sessionId, and then handle it from there. I guess its a case of do as they say, not as they do :) However, to address the original question - looks like you've got a capital M here in Message that you need to make lowercase to get the message instance: If(Message.getHeader().getField(msgType) == MsgType.EXECUTION_REPORT) { As a general note, if you get compile errors it is often helpful to include them in any mails along with your code snippets (ditto with logs for runtime issues). Hope that helps you. Toby -----Original Message----- From: qui...@li... [mailto:qui...@li...] On Behalf Of Shankar Krishnan Sent: 02 February 2006 22:50 To: qui...@li... Subject: [Quickfix-developers] Message.getHeader Hate to ask you this. I am trying to extract out the message Type value in the header to check if I am receiving a execution report. The following seems to fail on compiling. I did this by looking at the java example. Which goes like : public void run() { try { MsgType msgType = new MsgType(); if(message.getHeader().getField(msgType).valueEquals("8")) executionReport(message, sessionID); if(message.getHeader().getField(msgType).valueEquals("9")) cancelReject(message, sessionID); } catch(FieldNotFound e) { System.out.println(e); } } - I am trying to do this in C sharp. I have public void fromApp(Message message,SessionID sessionID) { MsgType msgType = new MsgType(); If(Message.getHeader().getField(msgType) == MsgType.EXECUTION_REPORT) { } } Should not this work. Tks _____ If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here <http://www.ml.com/email_terms/> for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ <http://www.ml.com/email_terms/> _____ |