Re: [Quickfix-developers] multiple sessions/connections
Brought to you by:
orenmnero
From: <Nil...@co...> - 2008-03-06 07:56:50
|
I would say don't create a Session object directly, use sessionfactory to create session object. What you have done is correct; you can use the lookupSession to retrieve the existing session object. Whenever there is factory pattern implemented, designer would force you to create object using the factory (by making the constructor method private), just to avoid accidental creation of object without factory. This is exactly what you are trying to do. I have no clue about your other question, regarding multiple sessions. Hope this will help -Nilesh ________________________________ From: azm...@gm... [mailto:azm...@gm...] On Behalf Of mr azmat Sent: Thursday, March 06, 2008 12:05 PM To: Gajjar, Nilesh (Cognizant) Subject: Re: [Quickfix-developers] multiple sessions/connections Nilesh, that is odd. I am using C#, but when I try to instantiate the Session class, the compiler won't let me. Then when I try to call Session.logout() or Session.logon() it won't let me because logon/logout aren't static members of the Session class. I'm trying to do all of this because I know of no other way to logout of a session. What I ended up doing was storing the sessionID and then calling like this: Session mySession = Session.lookupSession(SessionID) Then I can call logout/logon from mySession. mySession.logon() mySession.logout() I dont understand why I am unable to instantiate the Session class. When I get into work tomorrow, I'll take a screenshot of the message. I am now able to use logon/logout, but it wasn't as straightforward as I thought it should be. But I was wondering if you could answer my first question: "I need to setup 3 connections (one for market data, one for orders, and one for Drop Copies). Do I just need to setup the config file with three connections with the appropriate information?" thanks Nilesh, azmat On Thu, Mar 6, 2008 at 12:16 AM, <Nil...@co...> wrote: Hi Azmat I am not sure what you are talking about, there will always be a default public constructor for any cpp object, even if there is no user defined one. However I can see a constructor for Session object, am using the QF-1.12.4. source. ====================== #ifndef FIX_SESSION_H #define FIX_SESSION_H ... ... ... /// Maintains the state and implements the logic of a %FIX %session. class Session { public: Session( Application&, MessageStoreFactory&, const SessionID&, const DataDictionary&, const SessionTime&, int heartBtInt, LogFactory* pLogFactory ); ~Session(); void logon() { m_state.enabled( true ); m_state.logoutReason( "" ); } void logout( const std::string& reason = "" ) { m_state.enabled( false ); m_state.logoutReason( reason ); } ======================= Further, I don't understand a need to create Session object, as it is already created and ready to be used by SocketInitiator. Also note that QF provides you the sessionFactory, if there is a factory object available than its good idea to create a object using factory rather than creating it directly. It will be good if you can explain bit more in detail about the need to create a session object and need to call methods like logon and logout. Cheers -Nilesh >-----Original Message----- >From: qui...@li... [mailto:quickfix- >dev...@li...] On Behalf Of azmat >Sent: Thursday, March 06, 2008 4:39 AM >To: qui...@li... >Subject: Re: [Quickfix-developers] multiple sessions/connections > >QuickFIX Documentation: >http://www.quickfixengine.org/quickfix/doc/html/index.html >QuickFIX Support: http://www.quickfixengine.org/services.html > > >All- > >I need to setup 3 connections (one for market data, one for orders, and one >for Drop Copies). Do I just need to setup the config file with three >connections with the appropriate information? Also, how do I call >Session.Logon() or Session.Logout()? > >I can't instantiate an instance of Session (it lacks a constructor) and the >logon/logout methods are not static. Is this how I would logout/logon >specific sessions, if I were able to use these functions? > >many thanks to all. > >thanks! >azmat > > > > > >azmat wrote: >> >> All- >> >> I've setup two connections in my config file, but how do I start both >> sessions? Would they both get called if their information is in the >> "FixSettings.txt" file with the code below (when _initiator.start() is >> called): >> >> >> if (_initiator != null) >> throw new Exception("Already Started"); >> try >> { >> SessionSettings settings = new >> SessionSettings("FixSettings.txt"); >> QFWrapper application = new QFWrapper(this); >> FileStoreFactory storeFactory = new >> FileStoreFactory(settings); >> FileLogFactory logFactory = new FileLogFactory(settings); >> MessageFactory messageFactory = new >> DefaultMessageFactory(); >> _initiator = new ThreadedSocketInitiator(application, >> storeFactory, settings, logFactory, messageFactory); >> _initiator.start(); >> } >> catch (Exception e) >> { >> System.Diagnostics.Trace.WriteLine("FixServer.Start() >> ERROR: " + e.Message); >> } >> >> >> Also, I need to setup another session for Drop Copies, and I imagine the >> same rule applies to 3 sessions as it does with 2. Basically what I will >> be doing is cracking any messages received, and if the messages contained >> are MarketData Messages (specifically snapshot, incremental, or reject >> messages), I will use the appropriate market-data logic in my >application. >> If it is an execution Report then the cracker will pick it up and we can >> take care of it. Is this the correct approach? >> >> >> thanks! >> azmat >> > >-- >View this message in context: http://www.nabble.com/multiple-sessions- >connections-tp15834166p15862725.html >Sent from the QuickFIX - Dev mailing list archive at Nabble.com. > > >----------------------------------------------------------------------- -- >This SF.net email is sponsored by: Microsoft >Defy all challenges. Microsoft(R) Visual Studio 2008. >http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >_______________________________________________ >Quickfix-developers mailing list >Qui...@li... >https://lists.sourceforge.net/lists/listinfo/quickfix-developers This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. |