Announcement

Collapse
No announcement yet.

Get Server ID Programmatically

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get Server ID Programmatically

    I have two instances of Mirth Connect running on the same server and sharing a single DB. I want a means of programmatically getting the server ID of each instance from within Mirth for some custom logging and, ultimately, custom threading I'm trying to do. Is this possible?

  • #2
    Yes, our internal configuration controller supplies that: http://www.mirthcorp.com/community/f...va?r=7709#to95. You could also read the "server.id" file in appdata.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      Thanks for the reply, Nick.

      The ConfigurationController is perfect for my use-case, thank you.

      If I've got two Mirth instances running on the same server, each instance would have to be able to programmatically determine its own path in order for me to use "server.id" from appdata, which would also be possible using the ConfigurationController, but is a needless extra few steps.

      In case anyone else wants to do this, here's a code snippet:

      Code:
      var serverInstance = Packages.com.mirth.connect.server.controllers.ConfigurationController.getInstance();
      var serverId = serverInstance.getServerId();

      Comment

      Working...
      X