web stats
How to get the "connection status of channel" - Mirth Community

Go Back   Mirth Community > Mirth Connect > Development

Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2014, 12:17 AM
devdattak devdattak is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 17
devdattak is on a distinguished road
Default How to get the "connection status of channel"

Hi all,

I am trying to get the connection status of the particular channel in mirth (i.e., Waiting,Idle,Connected) right now am able to get the channel statistics,channel status,etc but for that am not able to find the solution.so please guide me how we can get this value using mirth

Thanks,
devk
Reply With Quote
  #2  
Old 05-07-2014, 12:39 AM
devdattak devdattak is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 17
devdattak is on a distinguished road
Default

Can any one help me to get this done
Reply With Quote
  #3  
Old 05-07-2014, 06:52 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

That is handled through the dashboard status column plugin. It makes an HTTP request to the server plugin to get connection states for each deployed channel. If you want to grab that information from the server side, it might be easiest to make a direct call to the service plugin's invoke method. The server-side plugin is here: http://www.mirthcorp.com/community/f...or.java?r=6894
__________________
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
  #4  
Old 05-07-2014, 09:49 AM
devdattak devdattak is offline
Mirth Newb
 
Join Date: Aug 2013
Posts: 17
devdattak is on a distinguished road
Default

Thanks for the reply and spent your time to post finally i got the solutions
Now i will post the solution for future purpose

//Return the live status of channel
function channelStatus(channelid){
var controller = com.mirth.connect.server.controllers.DefaultExtens ionController.create();
var monitor = controller.getServicePlugins().get(com.mirth.conne ct.plugins.dashboardstatus.DashboardConnectorStatu sMonitor.PLUGINPOINT);
var states = monitor.invoke('getStates',null,null);
var status = states.get(channelid + '_source_connector')[1];
return status
}

it will return the status like Idle,Disconnected,Connected,Waiting,etc...


Thanks again.
Reply With Quote
  #5  
Old 06-19-2014, 07:55 AM
saramurphy saramurphy is offline
What's HL7?
 
Join Date: Jun 2014
Posts: 1
saramurphy is on a distinguished road
Default

We are trying to pull the Connection Status of channel .I get an error that getInstance is not part of the object.

Online Casino Australia

Last edited by saramurphy; 06-20-2014 at 03:23 AM.
Reply With Quote
  #6  
Old 06-24-2014, 06:06 AM
daleking daleking is offline
What's HL7?
 
Join Date: Jun 2014
Posts: 1
daleking is on a distinguished road
Default

sorry i have no idea about that so i can't help you.....

online pokies

Last edited by daleking; 06-25-2014 at 01:59 AM.
Reply With Quote
  #7  
Old 01-12-2015, 10:09 PM
RJKHL7 RJKHL7 is offline
Mirth Newb
 
Join Date: Jun 2014
Posts: 16
RJKHL7 is on a distinguished road
Default Code above has spaces in it....

It appears the code snippet above has some artificial spaces inserted in some of the statements.

I created this in a code template and exported it for easier portability for the forum.
Attached Files
File Type: xml CodeTemplate_GetChannelStatusID.xml (822 Bytes, 154 views)
__________________
Engine: Mirth 2.2.2.6388
JRE:1.7.0
Reply With Quote
  #8  
Old 04-06-2015, 06:14 AM
Sudheer Sudheer is offline
Mirth Newb
 
Join Date: Sep 2014
Posts: 18
Sudheer is on a distinguished road
Thumbs up

Hi

am getting null in connection status, can any one help me out?

thanks in advance
Reply With Quote
  #9  
Old 05-04-2015, 07:51 AM
Jurjan Jurjan is offline
OBX.1 Kenobi
 
Join Date: Feb 2011
Posts: 37
Jurjan is on a distinguished road
Default

I'm using 3.2.0, and getting this error:
[2015-05-04 16:36:27,259] ERROR (com.mirth.connect.connectors.js.JavaScriptReceive r:135): Error executing JavaScript Reader script d967cfa5-fa96-4c75-90b5-5d43de6b5738.
com.mirth.connect.server.util.javascript.JavaScrip tExecutorException: com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
T_ALG_XXXX_CHK01CONNECTOR:
SourceSOURCE CODE:
106: logger.info('states: ' + states);107: // var status = states.get(channelid + '_source_connector')[1];108: //logger.info('status: ' + status);109: var status = states.get(channelid + '_source_connector');110: logger.info('status: ' + status);111: var status2 = status[1];112: logger.info('status2: ' + status2);113: return status;114: }115: // Versie: $Rev: 1489 $LINE NUMBER:
111DETAILS:
TypeError: Cannot read property "1" from null
at d967cfa5-fa96-4c75-90b5-5d43de6b5738:111 (channelStatus)
at d967cfa5-fa96-4c75-90b5-5d43de6b5738:761 (doScript)
at d967cfa5-fa96-4c75-90b5-5d43de6b5738:764
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.execute(JavaScriptUtil.java:67)
at com.mirth.connect.connectors.js.JavaScriptReceiver .poll(JavaScriptReceiver.java:101)
at com.mirth.connect.donkey.server.channel.PollConnec tor$PollConnectorTask.run(PollConnector.java:131)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
T_ALG_XXXX_CHK01CONNECTOR:
SourceSOURCE CODE:
106: logger.info('states: ' + states);107: // var status = states.get(channelid + '_source_connector')[1];108: //logger.info('status: ' + status);109: var status = states.get(channelid + '_source_connector');110: logger.info('status: ' + status);111: var status2 = status[1];112: logger.info('status2: ' + status2);113: return status;114: }115: // Versie: $Rev: 1489 $LINE NUMBER:
111DETAILS:
TypeError: Cannot read property "1" from null
at d967cfa5-fa96-4c75-90b5-5d43de6b5738:111 (channelStatus)
at d967cfa5-fa96-4c75-90b5-5d43de6b5738:761 (doScript)
at d967cfa5-fa96-4c75-90b5-5d43de6b5738:764
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:526)
at com.mirth.connect.connectors.js.JavaScriptReceiver $JavaScriptReceiverTask.call(JavaScriptReceiver.ja va:159)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)

anyone has any idea?
Reply With Quote
  #10  
Old 05-07-2015, 11:59 PM
Jurjan Jurjan is offline
OBX.1 Kenobi
 
Join Date: Feb 2011
Posts: 37
Jurjan is on a distinguished road
Default

For people following this:
I got it working using the following:
var ChanController = Packages.com.mirth.connect.server.controllers.Chan nelController.getInstance();
var defController = Packages.com.mirth.connect.server.controllers.Defa ultExtensionController.create();
var monitor = defController.getServicePlugins().get(Packages.com .mirth.connect.plugins.dashboardstatus.DashboardCo nnectorStatusMonitor.PLUGINPOINT);
var states = monitor.invoke('getStates', null, null);

status = states.get(channelID + '_0')[1];

Main, important, change seems to be the change from
states.get(channelID + '_source_connector')[1];
to
states.get(channelID + '_0')[1];

Last edited by Jurjan; 05-08-2015 at 12:00 AM. Reason: typo's
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:46 PM.


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