No announcement yet.

Dynamically determining the destination...

  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamically determining the destination...

    I have multiple end-points (End point 1, 2 & 3) communicating with the Mirth as an ESB. End point 1 needs to send certain messages to End Point 2 while other messages to End Point 3. End Point 1 & 2 & 3 cannot talk to each other directly, they can talk only through Mirth as a mediator. Based on the Message sent from End Point 1, Mirth has to determine the destination End Point. For example, the message itself will contain the destination where the message is addressed to. How do I achieve this in Mirth?

    Thanks in advance.

  • #2
    Reynamically determining the destination...

    I think that I didn't get 100% your question, (you call endpoint to source connector in Mirth, or you're using another instance of mule?).

    Anyway, you can use the routeMessage JS function to pass the mesasge to another channel.
    You can define one channel per destination and one channel to read all the messages (the "master" channel). If you read all the messages in this "master", you can use a JS destination to route the message to any of the other channels ...

    the function is

    router.routeMessage(channelName, 'message');
    Hope that helps


    • #3
      Reynamically determining the destination...

      Thank you. That did the job. It would be helpful if there is a document on the JavaScript functions provided by Mirth. Other than the one-liner tooltip help that comes in Mirth, are there any other help available on these functions? For example, I am trying to figure out what does the AddAttachment and GetAttachment functions do and I couldn't find any document that talks about this.


      • #4
        Reynamically determining the destination...

        If I read your description correctly, it sounds like you should be using multiple destinations, and a Filter on each destination to determine whether the message should be sent to that destination.
        Jacob Brauer
        Director, Software Development
        NextGen Healthcare



        • #5
          Reynamically determining the destination...

          Yes, correct, I have multiple destinations and a filter should decide whether to send message to that particular destination. Using the tip provided above in the forum, I did setup a master channel, which conditionally routes messages to the respective destination channels.

          Are there any documents on Mirth that would help understand the Javascript APIs?


          • #6
            Reynamically determining the destination...

            Perhaps you can solve your issue by setting up only a channel with multiple destinations and configuring the filter of these destinations (rather than the routeMessage over different channels).

            The JavaScript API IMHO is poorly documented, but keep in mind that you can always instantiate a custom Java Class from JavaScript. I found very interesting tricks exploring the sources.

            See you.