Announcement

Collapse
No announcement yet.

Passing data structure between channels

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

  • Passing data structure between channels

    I am having a problem where I am having a problem passing JSON between different mirth channels. The problem is how do i transform this string into an hl7 message that mirth can handle. I can already decode message element below but i need a way to convert the message element into an HL7 structure as if channel 1 sent channel 2 an HL7 message so i can access the e4x elements (ie) msg[PID]......

    The setup is Channel 1 receives and sends JSON structure to Channel 2.

    JSON structure is as follows:

    the message element is base64 encoded
    filename - just name of the file JSON was retrieved from



    {

    message: "4usouT&_...."
    filename: "testFile.txt"


    }

  • #2
    Originally posted by vill View Post
    i need a way to convert the message element into an HL7 structure
    Code:
    // decode base64-encoded message
    var hl7Message = new String(FileUtil.decode(<BASE64-ENCODED MESSAGE>));
    // and transform it to XML
    var xmlMessage = new XML(SerializerFactory.getSerializer('HL7V2').toXML(hl7Message));

    Comment


    • #3
      thanks

      Comment


      • #4
        You can also pass objects between channels without needing serialization, by using the source map. On a Channel Writer you can do this with the metadata table. When using router in a JavaScript context, you can send a RawMessage object containing the message and a source map with whatever entries you want.
        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