Re: [Quickfix-developers] Custom Logon Message
Brought to you by:
orenmnero
From: Scott K. <sc...@la...> - 2010-07-22 15:37:02
|
The lack of the const qualifier makes the non-const onMessage get used, but I always thought that was fishy. I suppose you're right it's not intended to be used that way. In fact, there's a bug in the current quickfix that makes the const one always be called. Though if I resent messages on a resendrequest (I currently don't), it would be useful to be able to breakout the resent messages using crack. On Thu, Jul 22, 2010 at 10:31 AM, Kenny Stone <ks...@co...> wrote: > crack is intended for inbound messages. It calls 'onMessage', saying you > received a message. > > How would you be able to tell if a message is inbound or outbound if you > call crack in toApp? > > http://quickfixengine.org/quickfix/doc/html/receiving_messages.html > > -- > Kenny Stone > Connamara Systems, LLC > > > On Thu, Jul 22, 2010 at 9:04 AM, Scott Kathrein < > sc...@la...> wrote: > >> QuickFIX Documentation: >> http://www.quickfixengine.org/quickfix/doc/html/index.html >> QuickFIX Support: http://www.quickfixengine.org/services.html >> >> >> Actually, I believe cracking works fine, another way to do this would be: >> >> void MyApplication::toAdmin(FIX::Message& message, const FIX::SessionID& >> sessionID) >> { >> crack( message, sessionID ); >> } >> >> void MyApplication::onMessage( FIX42::Logon& message, const >> FIX::SessionID& sessionid ) >> { >> message.set(FIX::Username("myusername")); >> message.set(FIX::Password("mypassword")); >> } >> >> where the MyApplication class extends FIX::Appliaction and >> FIX::MessageCracker >> >> This is how to use crack, but I just realized this specific example won't >> work because the username and password fields aren't defined for logon >> messages by default. (at least in FIX42). This would be the other way: >> http://www.quickfixengine.org/quickfix/doc/html/user_defined.html >> >> On Tue, Jul 20, 2010 at 8:33 AM, Kenny Stone <ks...@co...>wrote: >> >>> QuickFIX Documentation: >>> http://www.quickfixengine.org/quickfix/doc/html/index.html >>> QuickFIX Support: http://www.quickfixengine.org/services.html >>> >>> >>> Hi Arup, >>> >>> You shouldn't the the 'crack' method call. That is for receiving >>> messages. >>> >>> The way I code this would look something like: >>> >>> void FixApp::toAdmin(FIX::Message& msg, const FIX::SessionID& sessionID ) >>> { >>> FIX::MsgType msgType; >>> msg.getHeader().getField(msgType); >>> >>> // if logon >>> if( msgType.getValue() == FIX::MsgType_LOGON ) >>> { >>> FIX::Password pw( _my_password ); >>> msg.setField( pw ); >>> FIX::Username user( _my_username ); >>> msg.setField( user ); >>> } >>> } >>> >>> >>> -- >>> Kenny Stone >>> Connamara Systems, LLC >>> >>> >>> On Mon, Jul 19, 2010 at 11:48 PM, Sarkar, Arup <sar...@gm...>wrote: >>> >>>> QuickFIX Documentation: >>>> http://www.quickfixengine.org/quickfix/doc/html/index.html >>>> QuickFIX Support: http://www.quickfixengine.org/services.html >>>> >>>> >>>> Hi: >>>> >>>> I am very new to FIX and QuickFix in c++ engine. I am trying to build a >>>> custom logon messsage since "Username" and "Password" is required by the >>>> exchange. I am doing the following, basically overriding the toAdmin method. >>>> >>>> >>>> Can someone please help me in stating if this is correct? >>>> >>>> void Application::toAdmin(FIX::Message& message, const FIX::SessionID& >>>> sessionID) >>>> { >>>> std::string sLogon = "A"; >>>> crack( message, sessionID ); >>>> std::cout << "In toAdmin" << std::endl; >>>> std::cout << message << std::endl; >>>> try >>>> { >>>> if(sLogon.compare(message.getHeader().getField(35)) == 0 ) >>>> { >>>> std::cout<< " Setting username and password." << std::endl; >>>> message.getHeader().setField(553, "XXXXXXXXX"); >>>> message.getHeader().setField(554, "XXXXXXX"); >>>> } >>>> } >>>> catch(FIX::FieldNotFound& eFieldNotFound) >>>> { >>>> std::cout<< eFieldNotFound.detail << std::endl; >>>> } >>>> } >>>> >>>> -- >>>> Regards, >>>> Arup >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> This SF.net email is sponsored by Sprint >>>> What will you do first with EVO, the first 4G phone? >>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >>>> _______________________________________________ >>>> Quickfix-developers mailing list >>>> Qui...@li... >>>> https://lists.sourceforge.net/lists/listinfo/quickfix-developers >>>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by Sprint >>> What will you do first with EVO, the first 4G phone? >>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >>> _______________________________________________ >>> Quickfix-developers mailing list >>> Qui...@li... >>> https://lists.sourceforge.net/lists/listinfo/quickfix-developers >>> >> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> Quickfix-developers mailing list >> Qui...@li... >> https://lists.sourceforge.net/lists/listinfo/quickfix-developers >> > > |