Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

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

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

Attachment Handling Question

  • Filter
  • Time
  • Show
Clear All
new posts

  • Attachment Handling Question

    Good Day,
    I am attempting to use Mirth to upload several ZIP files via HTTP post to a web service and trying to figure out the best way to handle this.

    In the source connector I am adding the file as an attachment:
    var contents = FileUtil.readBytes(''.toString());
    var encData=FileUtil.encode(contents);
    channelMap.put('varAttachment', validate(encData, '', new Array()));
    Once done, how can I reference it in the HTTP sender? Currently I referencing the ${varAttachment} in the HTTP sender destination content, but I think I have it both as a channelMap and attachment so doubling up on storage/memory usage and seeing out of memory errors as a result.

    Any possibility to point me in the right direction would help, thanks!

  • #2

    I would use the native attachment handler on the source tab and attach the entire message. The article link I posted tells you how to reference it.
    Diridium Technologies, Inc.


    • #3
      Hi pacmano,
      Thanks. I use a database as the source which retrieves the file location, then I attach in the source transformer as shown below. The following your guide put it into a channel map, but resource wise it seems to be quite heavy as it is in a channel map variable and an attachment, is there a way that after making it an attachment I can just reference that in the destination?


      • #4
        In that case, read in the file in the transformer of the destination itself. No need to get it on the source side.

        var contents = FileUtil.readBytes('/tmp/'); // obviously fix the file name
        contents = FileUtil.encode(contents);
        var att = addAttachment(contents,"application/zip");
        $c('token', att.getAttachmentId())

        and in the http sender put in Content

        Obviously I don't know what your remote side really wants. e.g. binary vs base64 encoded.
        Diridium Technologies, Inc.


        • #5
          Beauty, thanks, I'll give it a go!