hl7mirth

How do you send a file separater in Mirth?


The HL7 receiver I am sending to is expecting a very specific end of file marker in a TCP Message:

<FS><CR>

Where <FS> is ascii 28 and <CR> is ascii 13.

We are using Mirth 2.x as our HL7 engine. The <CR> (Carriage Return) is fairly straight forward.

But how do I send the The File separator?


Solution

  • Here is how I was able to solve this problem.

    In the source transformer I defined "Start of File" and "End of File" variables like this:

    channelMap.put('SOF',String.fromCharCode(11)); // Start Of File: returns \v (vertical tab));
    channelMap.put('EOF',String.fromCharCode(28,13)); // End Of File: returns <FS><CR>);
    

    In the destination template I then did this:

    ${SOF}${message.encodedData}${EOF}
    

    I wrote the messages out to temporary file and opened them in a Hex Editor. I was able to confirm that the a 0x0B (Ascii 11) was written prior to the message and the message closed with 0x1C 0x0D (Ascii 28, Ascii 13)