Announcement

Collapse
No announcement yet.

Mirth 3.0.6931 Queueing Problem

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

  • Mirth 3.0.6931 Queueing Problem

    Hi together,

    I have the following Problem and I can't solve it:
    -> Receiving channel [Channel1], sending in one destination to [Channel2]. Value in "Channel Writer Settings" is "None".
    In JS destination transformer I use: router.routeMessage('Channel2', msg);

    If I stop the channel2 data will be lost - Error messages:
    [2013-10-17 14:03:50,745] ERROR (com.mirth.connect.connectors.vm.VmReceiver:173): Source connector is currently stopped. Channel Id: 24f2aad8-e850-4a8e-be72-b782434c4dd2
    com.mirth.connect.donkey.server.channel.ChannelExc eption
    at com.mirth.connect.donkey.server.channel.SourceConn ector.dispatchRawMessage(SourceConnector.java:172)
    at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.dispatchRawMessage(DonkeyEngineControlle r.java:496)
    at com.mirth.connect.server.userutil.VMRouter.routeMe ssageByChannelId(VMRouter.java:154)
    at com.mirth.connect.server.userutil.VMRouter.routeMe ssage(VMRouter.java:67)
    at com.mirth.connect.server.userutil.VMRouter.routeMe ssage(VMRouter.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox. java:126)
    at org.mozilla.javascript.NativeJavaMethod.call(Nativ eJavaMethod.java:225)
    at org.mozilla.javascript.Interpreter.interpretLoop(I nterpreter.java:1473)
    at org.mozilla.javascript.Interpreter.interpret(Inter preter.java:815)
    at org.mozilla.javascript.InterpretedFunction.call(In terpretedFunction.java:109)
    at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:3110)
    at org.mozilla.javascript.InterpretedFunction.exec(In terpretedFunction.java:120)
    at com.mirth.connect.server.util.javascript.JavaScrip tTask.executeScript(JavaScriptTask.java:49)
    at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:123)
    at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:100)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own Source)
    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)

    [2013-10-17 14:03:50,746] ERROR (com.mirth.connect.server.userutil.VMRouter:157): Error routing message to channel id: 24f2aad8-e850-4a8e-be72-b782434c4dd2
    com.mirth.connect.donkey.server.channel.ChannelExc eption
    at com.mirth.connect.donkey.server.channel.SourceConn ector.dispatchRawMessage(SourceConnector.java:172)
    at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.dispatchRawMessage(DonkeyEngineControlle r.java:496)
    at com.mirth.connect.server.userutil.VMRouter.routeMe ssageByChannelId(VMRouter.java:154)
    at com.mirth.connect.server.userutil.VMRouter.routeMe ssage(VMRouter.java:67)
    at com.mirth.connect.server.userutil.VMRouter.routeMe ssage(VMRouter.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox. java:126)
    at org.mozilla.javascript.NativeJavaMethod.call(Nativ eJavaMethod.java:225)
    at org.mozilla.javascript.Interpreter.interpretLoop(I nterpreter.java:1473)
    at org.mozilla.javascript.Interpreter.interpret(Inter preter.java:815)
    at org.mozilla.javascript.InterpretedFunction.call(In terpretedFunction.java:109)
    at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:3110)
    at org.mozilla.javascript.InterpretedFunction.exec(In terpretedFunction.java:120)
    at com.mirth.connect.server.util.javascript.JavaScrip tTask.executeScript(JavaScriptTask.java:49)
    at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:123)
    at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:100)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own Source)
    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)


    In both Channels "Source Queue" is "ON".

    When I change "Channel Writer Settings" to "Channel2" the following error occured:
    [2013-10-17 14:09:26,194] ERROR (com.mirth.connect.connectors.vm.VmReceiver:173): Source connector is currently stopped. Channel Id: 24f2aad8-e850-4a8e-be72-b782434c4dd2
    com.mirth.connect.donkey.server.channel.ChannelExc eption
    at com.mirth.connect.donkey.server.channel.SourceConn ector.dispatchRawMessage(SourceConnector.java:172)
    at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.dispatchRawMessage(DonkeyEngineControlle r.java:496)
    at com.mirth.connect.connectors.vm.VmDispatcher.send( VmDispatcher.java:141)
    at com.mirth.connect.donkey.server.channel.Destinatio nConnector.handleSend(DestinationConnector.java:54 0)
    at com.mirth.connect.donkey.server.channel.Destinatio nConnector.run(DestinationConnector.java:457)
    at java.lang.Thread.run(Unknown Source)

    BUT: the message is queued! When I start Channel2 the message will be delivered!

    My question: How can I queue messages with using "inline-routing" (the true/false option for queueing in "routeMessage"-function is no longer available)?


    Thanks in advance,
    Nils
    Last edited by nvb; 10-17-2013, 04:26 AM.

  • #2
    When I change "Channel Writer Settings" to "Channel2" the following error occured:

    BUT: the message is queued! When I start Channel2 the message will be delivered!
    I'm assuming in that case you have enabled the destination queue for Channel 1, correct?

    The message queues were changed significantly in version 3.0.0 and it is no longer possible for router.routeMessage() to write directly to the source queue of another channel that is currently stopped. The only alternatives are:

    1) Ensure that Channel 2 is always running
    2) Change your channel configuration to avoid using router.routeMessage and use a Channel Writer with it's destination queue enabled.

    If you need to route messages using router.routeMessage() to channel(s) that could potentially be stopped, then a workaround would be to create additional channels dedicated to queueing messages for those stopped channels. Those additional channels must remain started and must use Channel Writers with their destination queues enabled.

    I hope that helps, let me know if I misunderstood the problem.

    Comment


    • #3
      Another thing you can do is move that router.routeMessage call into a JavaScript Writer destination, and then turn queuing on for that destination.

      Code:
      try {
      	router.routeMessage('Channel2',message);
      } catch(e) {
      	return QUEUED;
      }
      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
        Hi both,

        thanks for your replies!

        @brentm:
        There are some reasons why this "old" sinking behavior is very important (imho):
        * If you have multiple destinations in one channel and only one receiver shouldn't get any messages (e.g. the destination system is busy or at maintenance) I often see that channels will be stopped. Customers know about the functions in Mirth 2.X.
        * If you have many channels in your Environment an e.g. one receiving channel in batch job pushes messages and the destination channel is not yet started you create a data loss (I know this could happen - after one dataloss I found the useQueue option :-)). I have implementations with 150+ channels and in 2.X this could happen.
        * I can't tell any customer using Mirth 2.X don't stop a channel because if done he creates a data loss if messages will be send to it.
        * And for me the most important thing: I can't fix all router.routemessage-implementations (I used this function in a basic way for nearly all implementations), this would be a time-problem for me to fix this in all channels I use this:-)

        Now about the "implementation" of the two channels:
        * the destination queueing is set to "Always" - the same result.

        @narupley:
        I'm sorry but "return QUEUED;" result was (maybe I didn't understand what "QUEUED" belongs to):
        Transformer error
        ERROR MESSAGE: Error evaluating transformer
        com.mirth.connect.server.MirthJavascriptTransforme rException:
        CHANNEL: Channel1
        CONNECTOR: --> to Channel2
        SCRIPT SOURCE: TRANSFORMER
        SOURCE CODE:
        29: //router.routeMessage('Channel2', msg);
        30:
        31: try {
        32: router.routeMessage('Channel2',message);
        33: } catch(e) {
        34: return QUEUED;
        35: }
        36: if ('xml' === typeof msg && msg.hasSimpleContent()) { msg = msg.toXMLString(); }if ('xml' === typeof tmp && tmp.hasSimpleContent()) { tmp = tmp.toXMLString(); }
        37: }
        38: if (doFilter() == true) { doTransform(); return true; } else { return false; }
        LINE NUMBER: 34
        DETAILS: ReferenceError: "QUEUED" is not defined.
        at 3d79d1c0-103f-40c2-9f5e-89d7bef9aa2f:34 (doTransform)
        at 3d79d1c0-103f-40c2-9f5e-89d7bef9aa2f:38 (doScript)
        at 3d79d1c0-103f-40c2-9f5e-89d7bef9aa2f:40
        at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:134)
        at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:100)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own Source)


        thanks,
        Nils

        Comment


        • #5
          Originally posted by nvb View Post
          @brentm:
          There are some reasons why this "old" sinking behavior is very important (imho):
          * If you have multiple destinations in one channel and only one receiver shouldn't get any messages (e.g. the destination system is busy or at maintenance) I often see that channels will be stopped. Customers know about the functions in Mirth 2.X.
          * If you have many channels in your Environment an e.g. one receiving channel in batch job pushes messages and the destination channel is not yet started you create a data loss (I know this could happen - after one dataloss I found the useQueue option :-)). I have implementations with 150+ channels and in 2.X this could happen.
          * I can't tell any customer using Mirth 2.X don't stop a channel because if done he creates a data loss if messages will be send to it.
          * And for me the most important thing: I can't fix all router.routemessage-implementations (I used this function in a basic way for nearly all implementations), this would be a time-problem for me to fix this in all channels I use this:-)

          Now about the "implementation" of the two channels:
          * the destination queueing is set to "Always" - the same result.
          There's no internal "soft" queue anymore for sending messages to stopped channels. In 2.x you could actually lose messages that way if the server was stopped. You can still do everything that you were doing in 2.x as far as guaranteed delivery goes, but instead you should use a Channel Writer or JavaScript Writer with queuing enabled.

          Originally posted by nvb View Post
          @narupley:
          I'm sorry but "return QUEUED;" result was (maybe I didn't understand what "QUEUED" belongs to):
          Transformer error
          ERROR MESSAGE: Error evaluating transformer
          com.mirth.connect.server.MirthJavascriptTransforme rException:
          CHANNEL: Channel1
          CONNECTOR: --> to Channel2
          SCRIPT SOURCE: TRANSFORMER
          SOURCE CODE:
          29: //router.routeMessage('Channel2', msg);
          30:
          31: try {
          32: router.routeMessage('Channel2',message);
          33: } catch(e) {
          34: return QUEUED;
          35: }
          36: if ('xml' === typeof msg && msg.hasSimpleContent()) { msg = msg.toXMLString(); }if ('xml' === typeof tmp && tmp.hasSimpleContent()) { tmp = tmp.toXMLString(); }
          37: }
          38: if (doFilter() == true) { doTransform(); return true; } else { return false; }
          LINE NUMBER: 34
          DETAILS: ReferenceError: "QUEUED" is not defined.
          at 3d79d1c0-103f-40c2-9f5e-89d7bef9aa2f:34 (doTransform)
          at 3d79d1c0-103f-40c2-9f5e-89d7bef9aa2f:38 (doScript)
          at 3d79d1c0-103f-40c2-9f5e-89d7bef9aa2f:40
          at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:134)
          at com.mirth.connect.server.transformers.JavaScriptFi lterTransformer$FilterTransformerTask.call(JavaScr iptFilterTransformer.java:100)
          at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own Source)
          As I stated in my previous post, that code should be in a JavaScript Writer destination, not in a transformer.
          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


          • #6
            Hi,

            thanks for answer - it worked basically, now the work starts converting 2.X to 3.X :-)

            Update: Sry, I looked wrong - it's the same behavoir like "normal" router.routeMessage above. One difference: The logs says error but in the dashboard you can't see the error ...



            regards,
            nils
            Last edited by nvb; 10-24-2013, 07:30 AM. Reason: Stupidity

            Comment

            Working...
            X