From: Martin V. <vse...@gm...> - 2017-08-10 08:44:46
|
Hi Matheson, thank you! It works great. Regards, Martin On Wed, Aug 9, 2017 at 11:48 AM, Øyvind Matheson Wergeland <oyv...@om...> wrote: > QuickFIX/J Documentation: http://www.quickfixj.org/documentation/ > QuickFIX/J Support: http://www.quickfixj.org/support/ > > > > Hi Martin, > > We also set SenderCompId programmatically. It is a long time since it was coded, so I had to look it up. We do it a bit differently, as we have our own config file read into sessionProperties below, and create a configuration with a set of sessions. > > We do it like this: > > settings = new SessionSettings(); > > // Set default settings > settings.setString(JdbcSetting.SETTING_JDBC_USER, user); > settings.setString(JdbcSetting.SETTING_JDBC_PASSWORD, password); > settings.setString(JdbcSetting.SETTING_JDBC_MAX_ACTIVE_CONNECTION, maxConnections); > settings.setString(JdbcSetting.SETTING_JDBC_DRIVER, jdbcDriver); > settings.setString(JdbcSetting.SETTING_JDBC_CONNECTION_URL, jdbcURL); > > // For each session > > // Read sessionProperties... > > SessionID sessionID = new SessionID(beginString, senderCompId, senderSubId, targetCompId, SessionID.NOT_SET); > > for (Object o : sessionProperties.keySet()) { > String key = (String) o; > if (key.startsWith("qfj.")) { > settings.setString(sessionID, key.substring(4) , sessionProperties.requireProperty(key)); > } > } > > > Hope this helps! > > > Best regards > > Øyvind Matheson Wergeland > CTO > > Mobile: (+47) 95 16 16 88 > E-mail: oyv...@om... > > Oslo Market Solutions > PO Box 4, 0051 Oslo, Norway > Telephone: (+47) 40 00 23 13 > www.oms.no > On 08/09/2017 10:22 AM, martyix wrote: > > QuickFIX/J Documentation: http://www.quickfixj.org/documentation/ > QuickFIX/J Support: http://www.quickfixj.org/support/ > > > Hi, > > I have a `quickfix-client.properties` file with the following contents: > > > ``` > [default] > HeartBtInt=30 > StartTime=00:00:00 > EndTime=00:00:00 > FileStorePath=data/trading/messages > ReconnectInterval=5 > UseDataDictionary=Y > FileLogPath=data/trading > DataDictionary=trading/FIX42.xml > SocketUseSSL=Y > # Client API key (on messages from the client) > # The property has to be in "default" session to be correctly overriden in > code. > SenderCompID=SUBJECT_TO_CHANGE <----- THIS IS IMPORTANT LINE > > [session] > BeginString=FIX.4.2 > ConnectionType=initiator > SocketConnectHost=some.server.com > SocketConnectPort=4198 > > TargetCompID=SomethingHere > ResetOnDisconnect=Y > ResetOnLogout=Y > ResetOnLogon=Y > ``` > > and now when I setup SocketInitiator class I do: > > ``` > SessionSettings settings = new SessionSettings(inputStream); // inputStream > corresponds with the config file above > > // <SOLUTION_I_TRIED> > // This does not seem to be the proper way to change SenderCompID. Why? > settings.getDefaultProperties().setProperty("SenderCompID", this.accessKey); > // This does not seem to be the proper way to change SenderCompID. Why? > settings.setString("SenderCompID", this.accessKey); > // </SOLUTION_I_TRIED> > > logger.debug("Settings: {}", settings); // the value of SenderCompID is > this.accessKey which is correct. However log file name contains > "SUBJECT_TO_CHANGE" instead of `this.accessKey` value. > MessageStoreFactory storeFactory = new FileStoreFactory(settings); > LogFactory logFactory = new FileLogFactory(settings); > MessageFactory messageFactory = new DefaultMessageFactory(); > > this.initiator = new SocketInitiator(this.application, storeFactory, > settings, logFactory, messageFactory); > > logger.debug("initiator.start()"); > this.initiator.start(); > ``` > > > How can I change <SOLUTION_I_TRIED> section to modify SenderCompID value? > > Thank you! > > Best regards, > Martin > > > > -- > View this message in context: http://quickfix-j.364392.n2.nabble.com/How-to-setup-initiator-with-modified-SenderCompID-value-tp7580086.html > Sent from the QuickFIX/J mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Quickfixj-users mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfixj-users > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Quickfixj-users mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfixj-users > |