web stats
Advice for receiving messages with metadata - Mirth Community

Go Back   Mirth Community > Mirth Connect > General Discussion

Thread Tools Display Modes
Old 01-13-2016, 08:45 PM
ahart ahart is offline
OBX.2 Kenobi
Join Date: Oct 2014
Posts: 56
ahart is on a distinguished road
Question Advice for receiving messages with metadata

We have one Mirth installation that will be sending messages of various types to another Mirth. These messages could be HL7, XML, or delimited text. Along with the message file, I'd also like to be able to send some metadata about the message.

We currently control both systems, the sender and the receiver, so I can do whatever is necessary on both ends to make it work.

My first thought was that I might take the message and build an XML wrapper around it that would contain the metadata and then an element containing the message itself, which I guess would have to be in a CDATA block. (?)

Second thought was, is it possible to send multiple documents in a single MLLP transmission. For example, I might have an XML document containing the metadata followed by the raw data pf the message contiguously, surrounding both with the SB and EB characters. Or is it ok to include some sort of non-standard separator character between the two. As I said, we control both ends.

How would any of you approach this problem? The metadata will consist of the filename, date received, message originator, and then an arbitrary list of name/value pairs that would allow me to "tag" the message in different ways. The receiver will parse this and then write the message to a CLOB and the metadata to other columns.

Thanks for your feedback.
Reply With Quote
Old 01-18-2016, 08:00 AM
sanderson sanderson is offline
OBX.1 Kenobi
Join Date: Dec 2015
Posts: 45
sanderson is on a distinguished road

I have defined an XML message structure which can contain the original message and its metadata along with error handling/audit elements which can contain custom messages or stacktraces etc. This wasn't in Mirth but the principle ought to be the same.

If you joined the instances with queues, the messages on the queue can have message properties, not used JMS with Mirth though.

No point in trying it with MLLP as you said your message can be HL7, csv, XML etc.

For HL7 you'd lose the MLLP part though, because you're not sending HL7 but some EBXML ish type of thing.

You could define an external DB with a message domain/originator and unique ID, where the ID is transported natively in the message eg for HL7 sequence or msg control id. You'd post a message's metadata to the database and the receiving interface gets its message normally over MLLP then looks up the metadata.
Reply With Quote
Old 02-10-2016, 08:21 AM
ahart ahart is offline
OBX.2 Kenobi
Join Date: Oct 2014
Posts: 56
ahart is on a distinguished road

Belated thank you for the reply.

I ended up doing what said in your first sentence: I just defined an XML structure containing all of the "metadata" and then a rawData element that is the original message base64 encoded.

I have one mirth instance that packages this up and sends it over a MLLP connection to another. MLLP seems to work just fine. There are versions of HL7 that are xml encoded, so it doesn't seem to know the difference. Looks like MLLP just uses those control characters to indicate start stop of message.

On the receving end, I get the xml message, extract the metadata into channel variables, including the raw message, which I then forward on to different channels just like I would any message along with the channel map variables populated from the metadata.

So, it seems to be working fine. Not sure that I'm getting any particular benefit (yet) from the MLLP ack/nak logic, but then I really haven't gotten into that yet.
Reply With Quote

mllp metadata multiple

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 08:10 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation