[Quickfix-developers] Dynamic sessions
Brought to you by:
orenmnero
From: Manuel L. <lop...@gm...> - 2008-05-16 00:55:34
|
Checking how to dynamically create session settings--is there an example or sample of this somewhere? (Good examples mean a lot fewer basic questions--my apologies if I've overlooked it--I just didn't find it) I would like to skip the use of the settings file entirely. Thanks. 1. I take it I should first create an empty new SessionSettings object: SessionSettings qfSettings = new SessionSettings(); 2. Then I manually add settings for the default section settings: ex.: qfSettings.setBool(string key, bool value) 3. Then I manually create a SessionID: ex. SessionID sessFatCorpId = new SessionID(FixVersionString, SenderCompId, targetCompId); (I assume "BeginString" is the fixversion string--the help file is not very chatty here--says "extends string value"). 4. Then I manually add the session values: ex. qfSettings.setLong(sessFatCorpId, stringKey, longValue) 5. Then I can pass the qfSettings object as a parameter to the SocketInitiator constructor. 6. To get a Session object and check and control on a session connection (start & stop & reset individual sessions etc.), do I use these Session methods: Session lookupSession(SessionID sessionID) and boolean doesSessionExist(SessionID sessionID) I'm unclear about: 1. What if I wanted to add another session (say sessionSkinnyCorp) to an existing initiator already running a session? I assume I shouldn't try to create a whole new initiator object (I'm not using the threaded initiator to keep things simple). (I'm not entirely sure what parts should be static and singleton--I assume the App object should be static, but the unthreaded initiator is unclear--will multiple instances conflict if writing to the same log and messagestore locations etc--is it better to share multiple sessions with one initiator.) 2. The use of the dictionary object in setting the settings. 3. How precisely to reconnect to the same sessionId after disconnecting (i.e. resuming without resetting the msg sequence ids back to 1). I assume if getRefreshOnLogon() is true, then doing a logon() to a session with the same fix version and sender and target ids (and session qualifier if any) will resume the messages at the same point, even if the sessionId is new and different. |