From: martyix <vse...@gm...> - 2017-08-09 08:22:55
|
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. |
From: Øyvind M. W. <oyv...@om...> - 2017-08-09 09:48:12
|
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body text="#000000" bgcolor="#FFFFFF"> <p>Hi Martin,</p> <p>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.<br> </p> <p>We do it like this:</p> <p><tt> settings = new SessionSettings();</tt><tt><br> </tt><tt><br> // Set default settings</tt><tt><br> </tt><tt> settings.setString(JdbcSetting.SETTING_JDBC_USER, user);</tt><tt><br> </tt><tt> settings.setString(JdbcSetting.SETTING_JDBC_PASSWORD, password);</tt><tt><br> </tt><tt> settings.setString(JdbcSetting.SETTING_JDBC_MAX_ACTIVE_CONNECTION, maxConnections);</tt><tt><br> </tt><tt> settings.setString(JdbcSetting.SETTING_JDBC_DRIVER, jdbcDriver);</tt><tt><br> </tt><tt> settings.setString(JdbcSetting.SETTING_JDBC_CONNECTION_URL, jdbcURL);</tt></p> <p><tt> // For each session</tt></p> <p><tt> // Read sessionProperties...<br> </tt></p> <p><tt> SessionID sessionID = new SessionID(beginString, senderCompId, senderSubId,</tt><tt> </tt><tt>targetCompId, SessionID.NOT_SET);</tt><tt><br> </tt><tt><br> </tt><tt> for (Object o : sessionProperties.keySet()) {</tt><tt><br> </tt><tt> String key = (String) o;</tt><tt><br> </tt><tt> if (key.startsWith("qfj.")) {</tt><tt><br> </tt><tt> settings.setString(sessionID, key.substring(4) , sessionProperties.requireProperty(key));</tt><tt><br> </tt><tt> }</tt><tt><br> </tt><tt> }</tt><tt><br> </tt></p> <p><br> </p> <p>Hope this helps!</p> <p><br> </p> <div class="moz-signature"> <title></title> <font face="Verdana"><small>Best regards<br> <br> <b><font color="#003366">Øyvind Matheson Wergeland</font></b><br> CTO</small><br> <small> <br> Mobile: (+47) 95 16 16 88<br> E-mail: <a class="moz-txt-link-abbreviated" href="mailto:oyv...@om...">oyv...@om...</a><br> <br> <b><font color="#003366">Oslo Market Solutions</font></b><br> PO Box 4, 0051 Oslo, Norway<br> Telephone: (+47) 40 00 23 13<br> <a class="moz-txt-link-abbreviated" href="http://www.oms.no">www.oms.no</a></small><br> </font> </div> <div class="moz-cite-prefix">On 08/09/2017 10:22 AM, martyix wrote:<br> </div> <blockquote type="cite" cite="mid:150...@n2..."> <pre wrap="">QuickFIX/J Documentation: <a class="moz-txt-link-freetext" href="http://www.quickfixj.org/documentation/">http://www.quickfixj.org/documentation/</a> QuickFIX/J Support: <a class="moz-txt-link-freetext" href="http://www.quickfixj.org/support/">http://www.quickfixj.org/support/</a> 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: <a class="moz-txt-link-freetext" href="http://quickfix-j.364392.n2.nabble.com/How-to-setup-initiator-with-modified-SenderCompID-value-tp7580086.html">http://quickfix-j.364392.n2.nabble.com/How-to-setup-initiator-with-modified-SenderCompID-value-tp7580086.html</a> 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! <a class="moz-txt-link-freetext" href="http://sdm.link/slashdot">http://sdm.link/slashdot</a> _______________________________________________ Quickfixj-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Qui...@li...">Qui...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/quickfixj-users">https://lists.sourceforge.net/lists/listinfo/quickfixj-users</a> </pre> </blockquote> <br> </body> </html> |
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 > |