Announcement

Collapse
No announcement yet.

Is it possible to implement a Mirth consumer?

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

  • Is it possible to implement a Mirth consumer?

    I'm trying to make Mirth a message broker in the following sense:

    Mirth should conditionally either broadcast messages to all devices, a specific device or group of devices.
    Devices who will be receiving messages can be offline sometimes.
    Messages are Queued in Mirth.
    When the device regains connection and authenticates with Mirth, he receives unread (queued) messages.

    I'm thinking of registering every device and its group in a DB.
    One channel writes messages to DB.
    Another listens for devices, SELECTing unread messages for the requesting device from the DB and then sends them.

    Is this the only/simplest way of doing this?
    Do I have better alternatives?

  • #2
    Another solution I thought up was:
    Pushing incoming messages into a queue of a dummy destination and then the listening channel pops them accordingly, is this possible and/or an alternative?

    I realize that this should be a job for a *MQ but I'm trying to replace an existing *MQ and consolidating everything in Mirth.

    Comment


    • #3
      Since channels/connectors/transformers themselves are meant to be largely stateless (take in a message, process it, send it out), it makes sense to store that consumer-specific data elsewhere, like in an RDBMS table. You could just have a separate destination (with it's own queue) for each consumer, so that when it comes online MC would automatically start sending to it. But that does not scale well to an arbitrarily large amount of consumers. With a separated data store, you'll be able to more easily handle new consumers, etc.
      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
        Originally posted by narupley View Post
        You could just have a separate destination (with it's own queue) for each consumer, so that when it comes online MC would automatically start sending to it. But that does not scale well to an arbitrarily large amount of consumers. With a separated data store, you'll be able to more easily handle new consumers, etc.
        Like you said, not scalable.
        Originally posted by narupley View Post
        [...], it makes sense to store that consumer-specific data elsewhere, like in an RDBMS table.
        Any chance I could keep that consumer-specific data in Mirth's internal DB?
        And create a channel to make CRUD operations to that table?

        "Want a new device? Sure! Send message to Mirth @ XYZ adress. Bam. Created."

        Comment


        • #5
          Originally posted by ab2488587 View Post
          Like you said, not scalable.


          Any chance I could keep that consumer-specific data in Mirth's internal DB?
          And create a channel to make CRUD operations to that table?

          "Want a new device? Sure! Send message to Mirth @ XYZ adress. Bam. Created."
          The same database server, sure. I would recommend creating a separate schema though, instead of touching mirthdb.
          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
            Originally posted by narupley View Post
            The same database server, sure. I would recommend creating a separate schema though, instead of touching mirthdb.
            Noted. Thank you.

            Just curious but is it possible to dynamically add destinations to a channel?
            Without stopping it?
            i.e. Channel A receives requests to add a device destination to channel B.

            This would require URLs to devices which I guess is not possible in my case, they wouldn't have static addresses, in most cases.
            Last edited by ab2488587; 12-19-2014, 07:58 AM. Reason: Typo

            Comment


            • #7
              Originally posted by ab2488587 View Post
              Noted. Thank you.

              Just curious but is it possible to dynamically add destinations to a channel?
              Without stopping it?
              i.e. Channel A receives requests to add a device destination to channel B.

              This would require URLs to devices which I guess is not possible in my case, they wouldn't have static addresses, in most cases.
              That is not possible, no. However you can use variables in your destination settings to dynamically send to different places for each message.
              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

              Working...
              X