web stats
Get Server ID Programmatically - Mirth Community

Go Back   Mirth Community > Mirth Connect > Development

Reply
 
Thread Tools Display Modes
  #1  
Old 09-02-2015, 03:55 AM
leecambl leecambl is offline
Mirth Newb
 
Join Date: Oct 2014
Location: Manchester, UK
Posts: 20
leecambl is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old 09-02-2015, 06:43 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 09-04-2015, 04:58 AM
leecambl leecambl is offline
Mirth Newb
 
Join Date: Oct 2014
Location: Manchester, UK
Posts: 20
leecambl is on a distinguished road
Default

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();
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 01:19 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation