Re: [Quickfix-developers] .Net: Cloning QuickFix.Message
Brought to you by:
orenmnero
From: Kotecha, R. <Rav...@st...> - 2009-09-30 09:59:11
|
Hi Regis, Have you tried the slightly more 'dirty' approach of setString? Instead of: NewOrderSingle order = new NewOrderSingle(message.ToString()); Try: NewOrderSingle order = new NewOrderSingle(); order.setString(message.ToString()); I've used something similar in the past when our QF engine would dump messages in a raw format straight into a database for processing later. Regards, Ravi Kotecha -----Original Message----- From: reg...@ho... [mailto:reg...@ho...] Sent: 29 September 2009 19:41 To: qui...@li... Subject: Re: [Quickfix-developers] .Net: Cloning QuickFix.Message QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Note that, the reason why I need to clone the message (which I would avoid to do as it's CPU consuming), is because it seems that when one tries to deal with the QuickFix message received directly from fromApp() or ToApp() asynchronoulsy the following problem arises: public void FromApp(Message message) { DoSomthingAsynchronously(message); crack(message); } will result in the asynchronous method to handle a message that can be "replaced" by the syncronous QuickFIX thread before it has a chance to be handled. e.g: -> Receive MSG1 -> Enqueue MSG1 for async processing -> Receive MSG2 -> Process MSG1 asyncronously -> It is now pointing to MSG2! This is probably due to a C++ memory handling approach but complicates things when used through the .Net Wrapper. Hope I make sense. Regis. On Tue, 29 Sep 2009 11:21:10 -0700 (PDT), Brian Erst <azz...@ya...> wrote: > It looks like it's because you're instantiating a base class (Message) and > trying to cast it to a derived class (NewOrderSingle). > > As far as I can tell, Message doesn't define a clone method, so you'd > probably have to figure out the message type first, then use the copy > constructor for the derived class, e.g. > > Message newMsg; > if (msg instanceof NewOrderSingle) > { > newMsg = new NewOrderSingle(msg); // NewOrderSingle's copy > constructor for NOS and Message are identical > } ... etc... > > Obviously, if you had a bunch of different messages you wanted to clone, > you'd be better off building a switch statement off the MsgType of the > message. > > - Brian Erst > Thynk Software, Inc. > > > > > ________________________________ > From: "reg...@ho..." <reg...@ho...> > To: qui...@li... > Sent: Tuesday, September 29, 2009 11:46:48 AM > Subject: [Quickfix-developers] .Net: Cloning QuickFix.Message > > QuickFIX Documentation: > http://www.quickfixengine.org/quickfix/doc/html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > > Hi, > > I'd like to clone FIX Messages. I have tried > fromApp(Message msg) > { > Message newMsg = new Message(msg.ToString); > } > > which seems to work fine. > Unfortunately it is thenimpossible to cast newMsg in any FIX subtypes! > e.g > > NewOrderSingle order = newMsg as NewOrderSingle; > > does not work anymore. (even though newMsg is indeed a NewOrderSingle > 35=D) > > Any idea why? > > Thanks, > > Regis > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® 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/devconf > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers ------------------------------------------------------------------------------ Come build with us! The BlackBerry® 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/devconf _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers ***************************************************************************** This communication is sent by the Standard Bank Plc or one of its affiliates The registered details of Standard Bank Plc are: Registered in England No. 2130447, Registered Office 20 Gresham Street, London, EC2V 7JE Authorised and Regulated by the Financial Services Authority. More information on Standard Bank is available at www.standardbank.com Everything in this email and any attachments relating to the official business of Standard Bank Group Limited and any or all subsidiaries, the Company, is proprietary to the Company. It is confidential, legally privileged and protected by relevant laws. The Company does not own and endorse any other content. Views and opinions are those of the sender unless clearly stated as being that of the Company. The person or persons addressed in this email are the sole authorised recipient. Please notify the sender immediately if it has unintentionally, or inadvertently reached you and do not read, disclose or use the content in any way and delete this e-mail from your system. The Company cannot ensure that the integrity of this email has beenmaintained nor that it is free of errors, virus, interception or interference. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. ***************************************************************************** |