RE: [Quickfix-developers] Message.getHeader
Brought to you by:
orenmnero
|
From: Shepheard, T. (London) <Tob...@ml...> - 2006-02-03 09:56:24
|
Shankar, =20 I'd suggest you use the more type-safe method recommended in the documentation (http://www.quickfixengine.org/quickfix/doc/html/receiving_messages.html ) =20 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 =3D new ClOrdID; message.get(clOrdID); ClearingAccount clearingAccount =3D new ClearingAccount(); message.get(clearingAccount); } public override void onMessage(QuickFix42.OrderCancelRequest message, QuickFix.SessionID sessionID) { ClOrdID clOrdID =3D new ClOrdID; message.get(clOrdID); // compile time error!! field not defined for OrderCancelRequest ClearingAccount clearingAccount =3D new ClearingAccount(); message.get(clearingAccount); } =20 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.=20 I guess its a case of do as they say, not as they do :) =20 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) =3D=3D = MsgType.EXECUTION_REPORT) { =20 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). =20 Hope that helps you. Toby =20 =20 -----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 =09 =09 =20 =20 Hate to ask you this. =20 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 : =20 public void run() { try { MsgType msgType =3D new MsgType(); =09 if(message.getHeader().getField(msgType).valueEquals("8")) executionReport(message, sessionID); =09 if(message.getHeader().getField(msgType).valueEquals("9")) cancelReject(message, sessionID); } catch(FieldNotFound e) { System.out.println(e); } } =20 - I am trying to do this in C sharp. =20 I have =20 public void fromApp(Message message,SessionID sessionID)=20 { =20 MsgType msgType =3D new MsgType(); If(Message.getHeader().getField(msgType) =3D=3D MsgType.EXECUTION_REPORT) { =20 } } =20 =20 Should not this work. =20 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 for important additional terms = relating to this e-mail. http://www.ml.com/email_terms/ -------------------------------------------------------- |