Blog

    Mirth Connect Disaster Recovery: Failover, Backup and In-Flight Messages

    By GauravAugust 18, 20269 mins read
    On this page

    Mirth Connect disaster recovery is mostly about in-flight messages: the ones a destination had not acknowledged when the engine stopped. The message store is the source of truth, failover onto the standby must not replay a destination that already accepted a message, and a database backup is something you restore before you read it.

    Written for digital health founders and hospital CTOs who run Connect in production, it covers storage settings, message statuses, the restore check and the recovery record.

    What happens to Mirth Connect in-flight messages when the engine fails?

    Mirth Connect keeps an in-flight message in its message store until each destination has finished with it, so the store is where recovery starts. Agnotic Technologies fails over to the standby, then reads that store: a destination that already acknowledged the message is not sent again, and one that never did is open work with an owner.

    Recovering Connect after a node failure?

    We treat the message store as truth, skip destinations that ACK'd, and count the rest.

    • In flight: the destination has not ACK'd. The store still holds the payload.
    • Done: ACK recorded. Failover must not send that destination again.
    • Backup: a copy of the database you can restore. It is not a menu of messages you can replay in place.
    • Check: last stored message id versus last delivered id, written by the owner after failover.

    A high-availability pair decides which node runs. It does not decide what happens to messages that were mid-destination when the active node stopped. That recovery work is what the sections below walk through.

    What must failover not replay?

    Failover must not replay a destination that already recorded an ACK. Agnotic compares status in the store to the receiver's last accepted id before any resend.

    • Do not resend: RECEIVED or SENT with an ACK from that destination.
    • Do resend, once, with an owner: QUEUED or ERROR with no ACK.
    • Do not guess from the backup file. Restore it first, then read status.

    Which storage setting decides whether a message can be recovered?

    The channel's message storage setting decides it. At Production level the engine keeps enough of each message to finish unfinished work on restart. Below that, recovery is manual or impossible.

    NextGen's Message Storage Settings state that with Durable Message Delivery on, unfinished messages are recovered and processed automatically if the channel halts or the server goes down. Raw storage drops destination queuing; Metadata and Disabled support no queuing.

    • Development: everything is stored. Recovery works, at the cost of disk.
    • Production: the level that keeps durable delivery and destination queuing.
    • Raw: the raw message is kept, so unfinished messages can be reprocessed by hand. No destination queue.
    • Metadata or Disabled: no content to recover. After a failure, the sender holds the only copy.

    Check this setting on every channel before an incident, not during one. A channel quietly moved to Disabled for throughput has nothing in flight to recover.

    The remove-content-on-completion options do not apply to errored or queued messages, so they do not erase in-flight work. They do limit what you can inspect about finished messages once the incident is over.

    Which message statuses count as in flight?

    A connector message is in flight when it is RECEIVED, TRANSFORMED, PENDING or QUEUED: work began and the destination has not finished. SENT and FILTERED are finished. ERROR is finished for the engine but still open for a person.

    • Open, engine retries: QUEUED, plus unfinished statuses that durable delivery picks up on restart.
    • Open, needs a person: ERROR, and any unfinished message in a channel stored below Production.
    • Closed: SENT with a response from the receiver, or FILTERED by a rule.

    Read the statuses for the window around the failure, not the channel's whole history. The question is what was moving when the node stopped, not everything the channel ever handled.

    Why is each destination recovered separately?

    Each destination keeps its own status for the same message, so recovery happens per destination. One message can be SENT to the EHR, QUEUED for billing and ERROR for the data warehouse at the moment the node stopped.

    Connect numbers the source as connector 0 and each destination from 1 upward. The recovery count is therefore a grid of message id by connector id, not one row per message.

    Reprocessing the whole message to fix one destination would resend to the other two. Agnotic picks only the open destination when it reprocesses, and writes down why.

    How does the destination queue change what failover leaves behind?

    The queue mode decides where an unsent message waits. With queuing on, it waits as QUEUED in the store and survives a restart. With queuing off, the send runs in line, and a failure during it leaves the message part-processed.

    NextGen's Destination Settings offer three queue modes: Never, On Failure (try to send, then queue), and Always (queue at once, so later destinations see QUEUED). With Validate Response on, a response that fails validation marks the message queued or errored.

    For recovery, Always is the easiest mode to reason about, because every outbound message is in the queue before its first attempt. The trade is that later destinations and the postprocessor never see this destination's response.

    On Failure sits between the two. A message that sends on the first try never enters the queue, and one that fails waits there like any other queued message.

    What should the restore check compare?

    It should compare, per channel and destination, the counts by status at failover and after recovery, plus the last message each receiver says it accepted. Both sides must agree before the incident closes.

    • Engine side: open connector messages per destination, with the oldest message id and its time.
    • Receiver side: the last control id or resource id the receiving system holds from this feed.
    • Gap: messages marked SENT on the engine that the receiver does not hold. These need investigation, not a blind resend.
    • Sign-off: the owner writes both ids and the open count on the recovery record.

    Run the comparison from a script that both sides can repeat. A count made by hand at the end of a long incident is the number most likely to be wrong.

    How do you read a backup without sending anything?

    Restore it into an isolated environment whose destinations cannot reach production receivers, then read the statuses there. A restored engine that starts its channels against live endpoints will deliver stale messages.

    • Isolate: no network route from the restore host to any production receiver.
    • Hold: keep channels undeployed while you read the message store.
    • Compare: match restored statuses with the live engine's statuses for the same message ids.
    • Decide: only then choose which messages, if any, the live engine should send.

    This is a read-only check Agnotic runs around the restore. The restore itself follows NextGen's guidance and the database vendor's documented procedure.

    What about messages the sender believes were delivered?

    That depends on when the source answered. If the channel ACKs after processing, a failure before the ACK makes the sender resend, so the receiver may see a duplicate. If it ACKs before processing, the sender has moved on and the stored copy is the only one.

    Either way, the source side belongs on the recovery record: which senders retried during the outage, and whether any receiver saw a message twice. A repeated MSH-10 is the usual sign.

    Agnotic asks each sending system's owner for their view of the outage window: what they sent, what they saw acknowledged, and what they held back. Their log covers the part of the story the engine never saw.

    A worked example: a node stops mid-send of lab results

    A worked example: the active engine stops while a results channel feeds three destinations: the EHR, a billing feed and an analytics store. The channel runs at Production storage, and the EHR destination queues on failure.

    • Step 1, the standby takes over, and durable delivery picks up the unfinished messages.
    • Step 2, the owner lists open connector messages: several QUEUED for the EHR, one ERROR for analytics, none for billing.
    • Step 3, the EHR team reports its last accepted control id. It matches the last SENT on the engine, so nothing is missing between them.
    • Step 4, the queue drains to the EHR, the analytics error is reprocessed for that destination only, and the record is signed.

    Nobody resent the billing messages, because the store showed them SENT and the billing team's last accepted id agreed. Leaving finished work alone is most of a clean recovery.

    What should the recovery record hold?

    It should hold enough for someone who was not on the call to see what was open, what was sent and who decided. Keep it with the incident ticket, not in a chat thread.

    45 CFR 164.312(b) requires mechanisms that record and examine activity in systems that contain or use electronic protected health information.

    • Scope: the failed node, the channels affected and the storage level of each.
    • Counts: open connector messages per destination at failover and at sign-off.
    • Actions: each reprocess or resend, with message ids and the person who approved it.
    • Close: last stored id, last delivered id and the owner's sign-off.

    When should you rehearse the recovery?

    Rehearse it in non-production after anything that changes how messages are stored or sent: a storage level change, a new destination, an engine or database upgrade, or a new failover setup. A recovery nobody has run is a guess.

    Use synthetic messages, stop the node mid-send on purpose, and run the same count and sign-off as a real incident. The gaps the rehearsal finds are cheaper than the ones a real outage finds.

    What are the common mistakes in Mirth Connect disaster recovery?

    The common mistakes are resending whole messages instead of open destinations, reading a backup on a host that can still reach production, and finding out during an incident that a channel stores no content. Each one turns a short outage into a data clean-up.

    • Reprocessing every message in the outage window, so receivers that already accepted them get duplicates.
    • Starting a restored engine with its channels deployed, so stale messages reach live systems.
    • Lowering a channel's storage level for speed without recording that it can no longer recover in-flight work.
    • Closing the incident on the engine's counts alone, without the receiver's last accepted id.

    How does Agnotic prove recovery?

    Agnotic checks the storage level of every channel before an incident, rehearses failover on synthetic messages, and after a real failover writes the last stored id and the last delivered id on a signed recovery record.

    Store first, then the count

    Skip ACK'd destinations. Restore a backup before you read it. Count what is still open.

    Related reading on Agnotic

    The HA pair, tuning the engine for volume, and pruning the message store.

    Sources

    Frequently Asked Questions

    No. Restore it first. A backup file is not a live queue.

    Talk to an engineer about your project

    Tell us which node failed. We will read the message store, skip ACK'd destinations, and count what is still in flight.