Blog

    Mirth Connect Channel Design Patterns and Architectures: Which Shape Fits Each Feed

    By GauravJuly 30, 20269 mins read
    On this page

    Mirth Connect channel design patterns and architectures decide what happens when an estate grows one channel at a time, each shaped like the last one someone copied. Without a chosen shape, a single channel ends up accepting every message type, editing all of them, and hiding its failures in the queue the sender is waiting on.

    The patterns here are for hospital CTOs, CIOs and digital health founders who are adding feeds to an interface engine, and for the engineers who build them. You get two channel shapes, the order of filter and transformer, a separate error channel, and how to pick a shape for a new feed.

    What is a channel design pattern in Mirth Connect?

    A Mirth Connect channel design pattern is a choice of shape: one channel per message type, or a router channel in front of those channels, with a filter before any transformer and a separate channel for errors. Agnotic Technologies picks the shape before any mapping script is written.

    Choose a Mirth Connect channel shape

    Our Mirth Connect page covers the channel designs we put in place for hospital interface teams.

    The shape answers three questions. Where does a new message type get its own failure domain? Where is a message allowed to change? Where does a message go when delivery fails? Answer those before you open the editor, and the next request has a place to land.

    NextGen Healthcare's Mirth Connect 4.0 release notes list filters and transformers as separate scripts the JavaScript debugger can open, alongside channel scripts, so a filter and a transformer are different steps in the channel.

    When should each message type have its own channel?

    Give each message type its own channel when the types have different destinations, different fields, or different failure rules. A problem in orders then stops orders. It does not stop the other types that happened to share a listener.

    • The source connector on that channel accepts one message type.
    • The filter on that channel asks one question: does the message belong to the type this channel owns?
    • The transformer on that channel edits only the fields that type needs.
    • Each destination has its own queue, so one slow receiver waits alone.

    This shape costs more rows to name and own. That cost is the point. A person can point at the orders channel and say whether it is supposed to be running, without reading a script that also handles results and documents. Use it when the sender can open one connection per type, or when something in front of the engine can split the connections for you.

    When should one router channel sit in front?

    Put one router channel in front when a sender will open only one connection and will mix message types on it. The router accepts that connection, chooses the downstream channel from the message type, and does not edit clinical fields.

    • One source on the router, matching the single connection the sender can open.
    • A filter that rejects types you have not agreed to accept, with the acknowledgment your agreement names.
    • A destination per downstream channel, chosen from the message type in the header.
    • No clinical mapping on the router. Mapping lives on the channel that owns the type.

    The layout is the same sender in both shapes. In the first shape the sender, or a listener in front, reaches one channel per type. In the second shape the sender reaches one router, and the router reaches one channel per type. The type-specific channels are where the message is allowed to change. The router only chooses.

    Two channel shapes side by side: one channel per message type, and a router in front of type-specific channels
    Router channel compared with one channel per message type
    QuestionOne channel per typeRouter in front
    Who accepts the senderEach type's own sourceThe router, one source
    Where fields changeOn that type's channelOn the downstream channel, never on the router
    What a failure stopsThat typeOnly the route that failed, if each destination is queued on its own
    When to pick itThe sender can use one connection per typeThe sender will mix types on one connection

    Why does the filter come before the transformer?

    The filter comes first because a filter accepts or drops and a transformer edits. A message you meant to ignore should not be edited, and an error in the transformer should not fail a message the filter would have skipped.

    The HIPAA Privacy Rule's minimum necessary standard requires covered entities to limit uses and disclosures of protected health information to the minimum needed for the purpose.

    Minimum necessary shows up here as a filter, not as a comment in a script. If a destination is allowed to receive only one message type, drop the others before any step rewrites a field. A transformer that 'handles the other types later' is a second channel hiding inside the first, and it will be skipped on the day someone is in a hurry.

    • Source filter: is this a message this channel is willing to see at all?
    • Destination filter: is this destination supposed to receive this particular message?
    • Transformer, after both yes answers: edit the fields that destination expects.
    • A filter that needs a transformed value is a sign the shape is wrong. Change the shape rather than editing first so the filter can pass.

    What is a separate error channel for?

    A separate error channel holds the original message, the error text and the name of the channel that failed, and it alerts a person. It does not re-map clinical fields and it does not retry forever inside the channel that already failed.

    • Send to it after the destination's own retries are exhausted, not on the first failure.
    • Keep the original message bytes, so a person can replay the message that actually arrived.
    • Include the channel name, the destination name and the time. Leave patient details in the message, not in a second copy pasted into an alert.
    • Give the error channel an owner. An unowned error channel is a quiet folder.

    Replay, when you do it, goes back through the type-specific channel so the same filter and the same mapping run again. The error channel's job ends when a person has the original message and has been told. A second copy of the mapping, maintained only on the error path, will drift the first time someone fixes a field in one place.

    What should the router be forbidden to do?

    The router may read the message type and choose a destination. It may not rewrite identifiers, dates or clinical values, and it may not grow a private exception for each sender. Those edits belong on the channel for that message type.

    • Forbidden: defaulting a missing field to a value the downstream system will store.
    • Forbidden: a branch per sending facility that maps codes differently. That is a type-specific channel, or a shared table the type-specific channel reads.
    • Allowed: drop an unknown message type and record the count, so a new type is visible.
    • Allowed: pass the original message through to the downstream channel unchanged.

    If the router script needs a paragraph of explanation, it has stopped being a router. Move the paragraph onto the channel that owns the type, where a test for that type can see it.

    How do you pick a shape for a new feed?

    Pick the shape from the sender's connection and from how you want failures to split. One connection and mixed types means a router. Separate connections, or a need to stop one type without touching the others, means one channel per type from the start.

    • Ask the sender how many connections they will open. Believe the answer.
    • List the message types on that connection. One type does not need a router.
    • List which types must keep working when one destination is down.
    • Write the choice in the request before build. Changing shape after go-live means moving live traffic.

    A feed with one message type is one channel. Do not add a router 'for later' and leave it empty. Add the router on the day a second type must share the connection, and move the existing channel behind it in a planned cutover.

    What goes wrong when errors stay in the working channel?

    Errors that stay in the working channel block the queue the healthy messages need, and they force every alert to mean 'open the channel and look'. A separate error channel keeps the working queue for work that can still succeed.

    The HIPAA Security Rule requires an accurate and thorough risk analysis of the potential risks and vulnerabilities to the confidentiality, integrity and availability of ePHI.

    Integrity and availability both suffer when a bad message sits at the head of a single queue and every later message waits. The working channel should be free to acknowledge and move, within the rule you set for order. The error channel is where the bad message waits for a person, without holding the rest of the feed behind it.

    How do you move an existing channel behind a router?

    • Step 1, build the router and the type-specific channel on a test engine, using the current sender's samples.
    • Step 2, deploy the router on a new port and keep the old channel running.
    • Step 3, point the sender at the router during an agreed window and watch both channels.
    • Step 4, stop the old channel once the type-specific channel has carried the agreed traffic. Keep it stopped rather than deleted.

    Plan the window with the sender's owner. The cutover is a change to their configuration as much as to yours.

    Should one error channel serve several working channels?

    It can, when every error row names the channel and the destination that failed and one owner answers all of them. Split it when different teams answer different feeds, so each team sees only the failures it can fix.

    Where should shared lookup tables sit?

    Keep a code table that several type-specific channels need in one place every channel reads, with one owner. A copy pasted into each channel becomes several versions that disagree after the first edit.

    What are the common mistakes with Mirth Connect channel design?

    Most mistakes are a chosen shape that drifted one quick fix at a time. Look for these in a review before the next feed copies them.

    • A router that has grown mapping logic.
    • A type-specific channel that now accepts a second message type.
    • A transformer that runs before the filter, so dropped messages are still edited.
    • An error channel nobody has opened in a long time.
    • Two channels for the same type and the same destination.

    How can Agnotic help you choose a channel shape?

    Agnotic looks at the connections your senders will actually open and at the message types on each one, then leaves you a shape: router or one channel per type, filters in front of transformers, and an error channel with an owner. The next feed follows that shape.

    Review a channel layout

    We will say which feeds need their own channel and which can sit behind one router.

    Sources

    Frequently Asked Questions

    The interface lead proposes the shape, and the hospital CTO or CIO, or the digital health founder who owns the feeds, signs it so every new channel follows it.

    Talk to an engineer about your project

    Tell us which senders open one connection and which message types share it. We will recommend a router or a channel per type before any build starts.