Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Development (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=8)
-   -   How to get the "connection status of channel" (http://www.mirthcorp.com/community/forums/showthread.php?t=10545)

devdattak 05-06-2014 11:17 PM

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

devdattak 05-06-2014 11:39 PM

Can any one help me to get this done

narupley 05-07-2014 05:52 AM

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

devdattak 05-07-2014 08:49 AM

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.

saramurphy 06-19-2014 06:55 AM

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

daleking 06-24-2014 05:06 AM

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

online pokies

RJKHL7 01-12-2015 09:09 PM

Code above has spaces in it....
 
1 Attachment(s)
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.

Sudheer 04-06-2015 05:14 AM

Hi

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

thanks in advance

Jurjan 05-04-2015 06:51 AM

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?

Jurjan 05-07-2015 10:59 PM

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


All times are GMT -8. The time now is 09:47 PM.

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