Mirth Connect 4.3.0 Released!

Mirth Connect 4.3.0 is now available as an appliance update and on our GitHub page.

This is a major release containing new features like adding new functionality to the Mirth Connect Setup Wizard, adding the ability for resource and channel-specific classloaders to load child-first or parent-first, and added a default implementation of the getObjectsForSwaggerExamples() method in the ServicePlugin class. This release also contains enhancements for the Mirth Connect Administrator Launcher, the Mirth Connect Docker images, and several bug fixes and security improvements.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

End-of-line problems

  • Filter
  • Time
  • Show
Clear All
new posts

  • End-of-line problems


    I am evaluating Mirth as a possible replacement for the HL7 messaging system that we are currently using. I thought that I might start with something simple, like having a File Reader source and a File Writer destination and make sure that the message went through the system with modification.

    My test environment is a Ubuntu Linux 6.10 system, running Sun Java 1.5_08, and Mirth 1.4.

    I started with some HL7 messages that we have stored in files. The messages were originally created on a Linux system, so the end-of-line character is a line-feed (0x0A). I tried to leave the settings as close to the default as possible. I set up the Source as a File Reader. I set up the Destination as a File Writer, with the Template set to ${message.encodedData}. Then I dumped 50 message files into the source directory.

    All 50 appeared in the destination directory. They were identical to the input files (which is what I was looking for) except for the fact that the EOL characters had been changed from the Unix EOL (0x0A) to the old MAC EOL (0x0D). I tried changing the encoding type but it did not effect the output.

    I went back and changed the Destination template to ${message.rawData}. I ran the original 50 messages through again, and got the same EOL replacement behavior.

    I then installed Java 1.5 update 11 and Mirth 1.4 onto a Windows XP system. I exported the channel and imported it onto that machine. Putting the same 50 messages into the inbound directory on the Windows XP system produced the same output - EOL characters changed from 0x0A to 0x0D.

    I'm not sure where to go from here. I could see Mirth changing the EOL from the Unix EOL to the Windows EOL on the Windows installation, but I can't see why both of them would change it to 0x0D. Our existing solution (written in Perl,) writes files using the EOL characters native to the platform that it is running on (0x0A on Linux, 0x0D0A on Windows).

    Any input would be appreciated.


  • #2
    Re: End-of-line problems

    This is a consequence of the parser and encoding rules for HL7. Mirth doesn't officially support non-standard (anything but 0x0D) end of segment/line characters by default, however it is very possible to get the behavior you desire.

    The first and easiest thing to try is:
    -Go into each transformer (on source and destination) and click on "Properties" on the Incoming Data and Outgoing Data tabs. Uncheck Use-Strict parser.
    -Run your files again and see if you have the same behavior.

    If that doesn't work, you can do a simple replacement in your javascript:
    var newHL7 = messageObject.getRawData().replace('\r', '\n');
    connectorMap.put("newHL7", newHL7);
    On your file writer template, drag newHL7 there instead of rawData

    (Alternatively you might need to do:
    var newHL7 = messageObject.getRawData().replaceAll("\r", "\n"); 
    var newHL7 = messageObject.getRawData().replaceAll("\\\\r", "\n");
    Try each if you are having problems.

    Hope this helps!
    Chris Lang


    • #3
      Re: End-of-line problems

      Greetings Chris:

      Thanks very much for your help. Unchecking the "Strict Parser" settings did not work, but the Javascript code certainly did.