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> |