Dynamic server configuration

Jon Fox
2010-04-13
2013-04-17
  • Jon Fox
    Jon Fox
    2010-04-13

    Firstly, thanks for an excellent piece of software. Having a bridge between a Java compatible server and Excel is very handy for building trading applications. I've found the library very solid & performant.

    One of the issues I have is the ability to develop and use a production client on the same machine (i.e. running multiple instances of Excel pointing at different hosts), since the Excel addin config is effectively global. I resolved this by patching your 0.2.2 library to check for existence of an environment variable to set the hostname & port, then writing a tiny launcher to set this appropriately before invoking Excel.

    Now I'd like to upgrade to your latest version, and would like your opinion on the best way to deal with the problem above; is there a better way, or would you be willing to make changes similar to mine (or I could redo & share with you)?

    Thanks in advance,

    Jon

     
  • Peter Smith
    Peter Smith
    2010-04-14

    Hi Jon,

    One of the features added to 0.3.1 was the ability to load INI keys from a registry location. This would allow you to set the server and port location in the registry. So you could set the following in your INI file:

    ini.registry.location=HKEY_CURRENT_USER\Software\MyApp

    And then in the register set the "server" key to be "localhost" or "production_host".

    Another option is to use multiple servers in your local config - you could set the ini keys like:

    server=localhost,production
    server.selection.mode=round-robin
    server.retry.count=1

    This would cause the addin to attempt to connect to your local machine and it that failed connect to your production machine. So if you start up excel with your dev server running it would connect that that, otherwise it would connect to production.

    Let me know if that works.

    Cheers,
    Peter

     
  • Peter Smith
    Peter Smith
    2010-04-14

    Actually, one more option - you can already use environment variables in your INI file and they will get expanded. So you can set:

    server=%XLLOOP_SERVER%:%XLLOOP_PORT%

    And this will be expanded by the addin (admittedly this isn't mentioned on the website - I will add some docs on this feature).