Re: [Quickfix-developers] Casting from "Message" to "org.quickfix.fix42.QuoteRequest"
Brought to you by:
orenmnero
From: <OM...@th...> - 2003-04-01 23:49:18
|
There is a couple of ways to do this, depending on how much type safety= you want. If you want to conitinue using the base Message class, you just = need to start using the non-type safe getField method instead of get. If yo= u want to be able to get a class that represents the message type, you ca= n use the DefaultMessageFactory class to create the derived message class= . You need to pass in a valid beginstring and a msgtype. To do this it might be worthwhile to put the values of just those two fields in separate columns in your database. Then you can pull them ou= t, pass them into the factory, and call setString using your stored string= . Then you will be able to cast the resulting message to the appropriate type. --oren |---------+-----------------------------------------------> | | Alexandre Hoang | | | <a....@ca...> | | | Sent by: | | | qui...@li...ur| | | ceforge.net | | | | | | | | | 04/01/2003 09:33 AM | | | | |---------+-----------------------------------------------> >--------------------------------------------------------------------= --------------------------| | = | | To: "'qui...@li...'" = | | <qui...@li...> = | | cc: Olivier Bonheur <o.b...@ca...> = | | Subject: [Quickfix-developers] Casting from "Message" to = | | "org.quickfix.fix42.QuoteRequest" = | >--------------------------------------------------------------------= --------------------------| Hello, I archive the FIX messages I receive through QuickFIX in an SQL Server database. Basically, if I receive a quote request, encapsulated in an object of c= lass "QuoteRequest", I do: "aQuoteRequest.toString()" and I put the string in the database. Now I want to retrieve from my database the quote request. So I first u= se a query to get the string I have just stored. Then a can create a Message: Message aMessage =3D new Message(stringRetrievedFromDB); But then, I cannot do the following: Symbol aSymbol =3D new Symbol(); aMessage.get(aSymbol); // does not work ! I actually need to cast to the "Message" to "org.quickfix.fix42.QuoteRequest". But this is not possible: I get a class cast exception. Is there a way to do this casting ? Or is there a better way to archive messages ? I have thought of archiv= ing the tags one by one, but doing with makes it more difficult to reconstr= uct an object of class "Message". Thanks for any idea, Alexandre -----Message d'origine----- De : qui...@li... [mailto:qui...@li...] Envoy=E9 : vendredi 28 mars 2003 21:35 =C0 : qui...@li... Objet : Quickfix-developers digest, Vol 1 #193 - 5 msgs Send Quickfix-developers mailing list submissions to qui...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/quickfix-developers or, via email, send a message with subject or body 'help' to qui...@li... You can reach the person managing the list at qui...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Quickfix-developers digest..." Today's Topics: 1. COM Error when trying to initialize acceptor (Jacob Steyn) 2. RE: COM Error when trying to initialize acceptor (Jacob Steyn) 3. Re: COM Error when trying to initialize acceptor (Vitor Castro) 4. SessionNotFound Exception sending messages in Java (David Monheit= ) 5. Message storage and retrieval (David Monheit) --__--__-- Message: 1 Date: Fri, 28 Mar 2003 10:58:53 +0200 From: "Jacob Steyn" <ja...@pe...> To: <qui...@li...> Subject: [Quickfix-developers] COM Error when trying to initialize acce= ptor HI All I get this error when in C# I try to start the socketacceptor. An unhandled exception of type 'QuickFix.ConfigError' occurred in =3D quickfix_net_debug.dll Additional information: Could not initialize COM Any Ideas? Thanks Jac --__--__-- Message: 2 Subject: RE: [Quickfix-developers] COM Error when trying to initialize acceptor Date: Fri, 28 Mar 2003 12:23:24 +0200 From: "Jacob Steyn" <ja...@pe...> To: "Vitor Castro" <vc...@hi...>, <qui...@li...> Hi Vitor Thanks. Im not trying to expose them. Using the default quickfix_net_debug.dll in 1.4.0 and just referencing it in my .net solution which doesnt register in COM. -----Original Message----- From: Vitor Castro [mailto:vc...@hi...] Sent: 28 March 2003 11:27 To: Jacob Steyn; qui...@li... Subject: RE: [Quickfix-developers] COM Error when trying to initialize acceptor Hi Jac, Are you trying to expose the objects in quickfix_net_debug.dll as COM objects? If not check to see if your quickfix .net project isn't by mistake enabling the registration of the dll as a COM server. -----Original Message----- From: qui...@li... [mailto:qui...@li...] On Behalf Of Jacob Steyn Sent: sexta-feira, 28 de Mar=3DE7o de 2003 8:59 To: qui...@li... Subject: [Quickfix-developers] COM Error when trying to initialize acceptor HI All I get this error when in C# I try to start the socketacceptor. An unhandled exception of type 'QuickFix.ConfigError' occurred in quickfix_net_debug.dll Additional information: Could not initialize COM= Any Ideas? Thanks Jac ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers --__--__-- Message: 3 From: "Vitor Castro" <vc...@hi...> Cc: <qui...@li...> Subject: Re: [Quickfix-developers] COM Error when trying to initialize acceptor Date: Fri, 28 Mar 2003 10:18:20 -0000 Organization: HiperBit Hi Jac, Are you trying to expose the objects in quickfix_net_debug.dll as COM objects? If not check to see if your quickfix .net project isn't by mistake enabling the registration of the dll as a COM server. -----Original Message----- From: qui...@li... [mailto:qui...@li...] On Behalf Of Jacob Steyn Sent: sexta-feira, 28 de Mar=3DE7o de 2003 8:59 To: qui...@li... Subject: [Quickfix-developers] COM Error when trying to initialize acceptor HI All I get this error when in C# I try to start the socketacceptor. An unhandled exception of type 'QuickFix.ConfigError' occurred in quickfix_net_debug.dll Additional information: Could not initialize COM= Any Ideas? Thanks Jac ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers --__--__-- Message: 4 Date: Fri, 28 Mar 2003 14:47:47 +0000 From: David Monheit <Dav...@mo...> Reply-To: Dav...@mo... Organization: Morgan Stanley To: qui...@li... Subject: [Quickfix-developers] SessionNotFound Exception sending messag= es in Java Hi all, Coming along in QF. I saw some old threads which experienced this exac= t problem, ie, QF for Java has some problem finding the right session. Here is the scoop: There are 3 overrides to Session.sendToTarget a) sendToTarget(Message) b) sendToTarget(Message, SessionID) c) sendToTarget(Message, SenderCompID (string), SenderTargetID (string)= ) It turns out that no matter what I tried with c, I ALWAYS got SessionNotFound!!! I also noticed that if I set the following in the cfg file: SenderCompID=3DOrderEngine TargetCompID=3Dmonheit I got back a sessionID of "FIX.4.0:OrderEngine->monheit" on the C++ program, ie, executor. When I ran my order entry program in Java with = a cfg of: SenderCompID=3Dmonheit TargetCompID=3DOrderEngine the sessionID was "FIX.4.0: monheit->OrderEngine" !!! Note the space i= n there!!!! The way I got it to work is by using override b, and sending the SessionID which I got on the order... I did not try method a yet. Need to have a look at why this is. Regards David --__--__-- Message: 5 Date: Fri, 28 Mar 2003 15:06:53 +0000 From: David Monheit <Dav...@mo...> Reply-To: Dav...@mo... Organization: Morgan Stanley To: Quickfix <qui...@li...> Subject: [Quickfix-developers] Message storage and retrieval Hi Starting the debate of earlier threads again... IMHO a client app could either try to keep the state of the world (SOW)= itself of delegate it to something else which then uses different methods for dispersing this info. A client app could go to a db to get= known orders and status on startup, connect to a pub/sub system and request the current SOW or whatever. A server, however, specially something like an order manager must keep track of its orders EVEN through a core !!! As Oren mentioned in some earlier thread, this presents a problem. Server which handle large order flow will have a huge FIX traffic whose latency needs to be kept to a minimum. Writing orders to a db or whatever is basically out of the quesion because of the IO time involved. Since QF does have the logs stored if the file system one would imagine that re-loading the order server to the state prior to a core is just a matter of replaying= the messages and rebuiding the order collection. This however, is a server problem, not a qf problem. I would vote for writing a small library for reading and even better, replaying these messages. For instance we could create a MessageReplayApplication whic= h subclasses Application. This classes' thread would read the inbound lo= g file and invoke fromApp callbacks. Any messages sent by this app would= be ignored!!!! This would allow a server to rebuild its state. When done, the main class deletes this playback object and start the real one.... Just a thought anyways. The point is that for some apps we DO need to have not just message recovery but state recovery as well... David -- NOTICE: If received in error, please destroy and notify sender. Sender= does not waive confidentiality or privilege, and use is prohibited. --__--__-- _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers End of Quickfix-developers Digest * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *= * * Confidentiality Notice : The information contained in this e-mail message is intended only for t= he personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible f= or delivering it to the intended recipient, you are hereby notified that y= ou have received this document in error and that any review, dissemination= , distribution, or copying of this message is strictly prohibited. If you= have received this communication in error, please notify postmaster@cadextan= .fr immediately by e-mail, and delete the original message. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *= * * ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers = |