Announcement

Collapse
No announcement yet.

How to get the "connection status of channel"

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

  • 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

  • #2
    Can any one help me to get this done

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          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, 02:23 AM.

          Comment


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

            online pokies
            Last edited by daleking; 06-25-2014, 12:59 AM.

            Comment


            • #7
              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
              Engine: Mirth 2.2.2.6388
              JRE:1.7.0

              Comment


              • #8
                Hi

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

                thanks in advance

                Comment


                • #9
                  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?

                  Comment


                  • #10
                    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-07-2015, 11:00 PM. Reason: typo's

                    Comment


                    • #11
                      Hi Jurjan,

                      By chance, do you know how to get the history of the connection status ?

                      With your code, I have only the current status

                      Thank you in advance for your help.

                      Regards

                      Comment


                      • #12
                        Originally posted by Jurjan View Post
                        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);sony z5 schutzh├╝lle

                        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];
                        Although a bit complicated, but it is very helpful, thank you very much
                        Last edited by Shakurr; 09-15-2015, 06:13 PM.
                        Wieviel Sprachen du kannst, wieviel male bist du Mensch!

                        Comment


                        • #13
                          Originally posted by Jurjan View Post
                          For people following this:
                          I got it working using the following:


                          Code:
                          var ChanController = Packages.com.mirth.connect.server.controllers.ChannelController.getInstance();
                          var defController = Packages.com.mirth.connect.server.controllers.DefaultExtensionController.create();
                          var monitor = defController.getServicePlugins().get(Packages.com.mirth.connect.plugins.dashboardstatus.DashboardConnectorStatusMonitor.PLUGINPOINT);
                          var states = monitor.invoke('getStates', null, null);
                          
                          status = states.get(channelID + '_0')[1];

                          I have been following this and I wanted to say thank you for all your work. This works for version 3.x!

                          Comment


                          • #14
                            @C3G,
                            mmmhhh, as far as I know (NOT very far) that's not possible out of the box.

                            If needed I would have a channel pick up the connection status every X time.
                            Then put that value in a database table, together with a key (channel_ID?) and time of collection and perhaps the name of the channel for us mere humans.

                            Then when I would want to know the history i could simply query for it.

                            Comment


                            • #15
                              Originally posted by Jurjan View Post
                              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?
                              I still get this even after putting in various "fixes" suggested here in the forum. I have yet to go line by line and make sure all my mappings are correct. I'm guilty of doing a cut and paste and "scratch head" when it doesn't work. I will say that I'm getting different errors and it looks like the channel is making it "further" but I still get the "1" from null error. I'm wondering if setting up a debug environment would help.

                              Comment

                              Working...
                              X