A way to think about Mirth - rbeckman-nextgen/test-mc GitHub Wiki
Created by Jacob Brauer, last modified on Mar 23, 2009
The hardest part of Mirth is getting your head around what is REALLY going on. I'm not sure I have it down completely, but here's where I am so far...hopefully this will help you.
Mirth is like an airport with one entrance, and one or more gates. Everything starts when you walk in the building. Different things can happen as you move to your plane, things that can change you, sometimes slightly, sometimes completely. When you board the airplane, you are different, better, for the experience.
Add to the above that, like an amoeba, you can split and duplicate yourself at any point in the process, once you have entered the building. And each identity can then take a separate path through the building leading to different transformations and gates. (It's not for nothing that I was a philosophy major...no really, it cost a lot).
Add to the above that, as any of the identities are moving along, they can make information about themselves available to themselves further down the road. OK, now we're getting REALLY convoluted. See why you were confused?
Let's take a simple walk through the airport, touching each of the areas that might make a difference. In the easiest example, information comes in the door in some way (read in from a file? captured by the LLP Listener?). It doesn't matter HOW it gets there, it's just there. Where is there? It starts in the ticketing area, which in Mirth is the Source tab. In the source area is the first place that change takes place. To begin, everything that comes in is converted to XML internally. You don't need to see it, or even deal with it, but it has happened. If you are comfy with XML, that is a good thing. If you are not comfy with XML, Mirth doesn't require that you go out and learn all that stuff.
Great, so whatever the information looked like as it came in the door, it's changed, whether we see it or not. From the source tab, we can CHOOSE to change it even further. We can place limits on the information to keep it from going further by setting a filter by using the Edit Filter button on the left side. Think of this as going through security. If the TSA says you aren't getting in, you'll go no further than the waiting area (Mirth will not put you through a strip search). However, if the TSA thinks you're safe, you move on. It's possible in Mirth to skip security...you don't have to have a filter.
Out of security you go into the walkway, where all the stores are. The walkway, in Mirth, is the transformer for the source tab. With a name like transformer....well, I've read enough sci-fi that I could probably describe lights and whoop-whoop noises, but it's not really necessary to understand how Mirth transformer works. Just know that the transformer can do a LOT of work...or none whatsoever. If you don't add anything to the transformer in source, it's as if the security leads right out to your gate.
Oh, the gate. That would be a destination. For our simple example, we are going to have only one gate in our small airport, but like any airport, you can have a BUNCH of them, if you want. Each one has a jetway leading to the plane. Things can happen to your information there also. There's a filter (this one's not TSA...uh...it's the gate agent saying you need to show your ticket) which is a limit on the information as it looks once it gets to the jetway and there is a transformer with the destination tab that can further change the information before letting you on the plane. And the really cool thing is that you can have a different gate agent and different jetways for each destination. Lots and lots of gates, each with a jetway before you go out.
You can even have it set up that exiting from one airport sends you to another airport with all of the power that THAT place has to change you. And while there are lots and lots of walkways and gates and ways of getting in and out, each place (source or destination) works the same. There's a filter and a transformer at every stage of the trip.
While the filter is basically a yes-no kind of decision, the transformer can do a lot...actually, as much as you need it to, because you can add as many steps as you need to transform the information at whatever stage of the process you happen to be. In the beginning (the ticketing area...the source tab) you might just want to get the relevant information, change its format a bit and stick it into buckets that you can use later. Or you may choose to trim it up before sending it to the gates.
To make it easier for you, the information as it comes into any area is considered to be the starting message. And the information as it will look as it is going to go out the next door is a template. And both of those versions of the information in the transformer are alive at the same time! (whoop, whoop). You can talk to the starting message, whose name is msg, and refer to or modify elements of that msg. And you can talk to the finishing template, whose name is tmp, and refer to or modify elements of that tmp. And you can copy from one to the other, making changes along the way. And you can EVEN make your life easier by putting example information in the incoming data and outgoing data tab, and Mirth will do its level best to apply that view of the information to the data that has actually walked in the door.
When all is said and done in the transformer, tmp walks out and becomes msg in the next area, ready for its next change.
The trick is to realize that at any given time and place there are two different views of the information, the way it was and the way it will become. Anything you do to what was, will affect what will be. You are the accumulation of your past, but you need to keep an eye and a focus on your future (philosophy again). Mirth is a tool of transformation. Life without Mirth would be dreary and unchangeable, as true of life as your data.
We'll be spending more time in the individual areas, because that's where the work is actually done. We'll look at the transformer a great deal, and talk about appropriate times to do different kinds of changes, but it's all about change and how you accomplish it.
Document generated by Confluence on Nov 11, 2019 08:40