Run beside Mirth or Rhapsody, then cut over
Connect MedHook to a running Mirth Connect or Rhapsody engine, run a workflow on the same traffic without delivering anything, and read a diff report before you cut over.
On this page
This guide runs MedHook beside the engine you have today. MedHook reads the incumbent's channel status through its API, runs your new workflow on the same messages in shadow mode, and compares its output with the incumbent's, field by field. At the end you have a cutover report: a match rate, the fields that differ and every message behind them.
Shadow mode means MedHook runs the workflow as a dry run. Every step runs, but no destination is called, so nothing reaches a downstream system and no execution is stored. The incumbent keeps doing the real work until you cut over.
sequenceDiagram
participant Sender as Sending system
participant Legacy as Mirth or Rhapsody
participant Engine as MedHook engine
participant Dest as Destination
Sender->>Legacy: ADT^A01 over MLLP
Legacy->>Dest: Production delivery
Sender-->>Engine: Copy of the message (tee)
Engine->>Engine: Run the workflow in shadow mode
Legacy-->>Engine: Copy of its output (capture)
Engine->>Engine: Compare both outputsThis is a parallel run, not a live sync. MedHook never changes the incumbent's configuration, never starts or stops its channels and never sends on its behalf. Moving channels across is still an import (Mirth or Rhapsody) or a rebuild, and the export back to Mirth stays your escape hatch.
Before you start
- A MedHook workflow for the interface. Import it from Mirth (Migrate from Mirth Connect) or build it. It can stay disabled: the parallel run does not need it deployed.
- A read-only user on the incumbent's management API: the Mirth Connect REST API (
https://<mirth-host>:8443/api) or the Rhapsody REST API. - The incumbent's API host listed in
SSRF_ALLOWLISTon the engine. The engine refuses private addresses unless they are listed there, and an incumbent is almost always on a private network. See Environment variables. - An HTTPS API URL. Plain
http://is accepted only for a host listed inSSRF_ALLOWLIST, so the password never crosses an untrusted network in clear text.
Choose a topology
Messages reach the parallel run in one of three ways. You can combine them.
| Topology | How it works | Use it when |
|---|---|---|
| Tee | The sender keeps sending to the incumbent. A copy of each message also goes to the run's inbound route, from the incumbent (an extra destination) or from the network. | You don't want to touch the sender's connection yet. |
| MedHook in front | Senders point at MedHook. A passthrough workflow forwards each message to the incumbent over MLLP, unchanged, and a second destination posts a copy to the run's inbound route. | You are already moving senders to MedHook, as in Cut over from Rhapsody. |
| Mirth message API (sync) | MedHook reads the Mirth channel's processed messages, with their source and output, from the Mirth API. | The incumbent is Mirth and you want a comparison without changing any connection. |
The incumbent's output reaches the run either by sync (Mirth) or at the capture route: add an HTTP destination to the incumbent channel that posts its output to MedHook. In Mirth this is an HTTP Sender; in Rhapsody an HTTP client communication point.
Steps
1. Connect the incumbent
Open Migration › Parallel runs and choose Set up a parallel run, or call the API. In the panel that opens, choose Add connection. Add a connection with the API URL, a user and a password. For Mirth, choose HTTP Basic or a session login; MedHook sends the X-Requested-With header that Mirth requires. Rhapsody uses HTTP Basic.
curl -X POST https://engine.example.test/api/incumbents \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name":"Demo Health Mirth","kind":"mirth","baseUrl":"https://mirth.example.test:8443/api","authMode":"session","username":"medhook-readonly","password":"..."}'The password is stored encrypted, like adapter profile credentials, and is never shown again. Only operators can read the channel status, because each read is a live call to the incumbent.
Remove asks first, with Remove connection. MedHook stops reading that engine and deletes the saved credentials. Runs that used it keep their messages, but Sync from Mirth then needs a new connection. Nothing changes on the old engine.
2. Read the channel status
Choose Channel status. MedHook reads the incumbent's channels live: for Mirth, every channel with its state and its received, sent, error, filtered and queued counts; for Rhapsody, every route and communication point with its state and counts. Each row shows the MedHook workflow that replaces it. A channel you imported matches its workflow even after you rename the workflow; otherwise the names are compared without case, spaces or punctuation.
3. Start a parallel run
Under Parallel runs in the same panel, give the run a name, choose the workflow, and optionally the incumbent connection and channel, then choose Start parallel run. For Mirth, the channel id is what makes sync possible.
Some fields differ on every message whichever engine produces them. The run always ignores MSH-7 (message time) and MSH-10 (control id) in HL7 v2, and meta.lastUpdated and meta.versionId in FHIR. Add your own in Also ignore, for example EVN.2, PID.3.4 (one component) or entry[*].fullUrl. The rules are in Parallel runs.
4. Send traffic to the run
Each run has two intake routes. Both take the raw message as the body, or JSON { "message": "...", "correlationKey": "..." }.
- Inbound copies go to
POST /api/parallel-run-intake/<id>/inbound. MedHook runs each one through the workflow in shadow mode. - The incumbent's outputs go to
POST /api/parallel-run-intake/<id>/incumbent-output.
Both routes take one credential only: the run's capture token, sent as the X-Capture-Token header. MedHook shows it once, when you start the run. It can post messages to that run and nothing else, so it is safe to put on the incumbent's HTTP destination. New capture token asks first, with Make a new token: the old token stops working at once, and the new one is shown once. Revoking it closes the intake. MedHook keeps only a hash of the token.
curl -X POST https://engine.example.test/api/parallel-run-intake/<id>/incumbent-output \
-H "X-Capture-Token: $CAPTURE_TOKEN" -H "X-Correlation-Key: MSG0001" \
-H "Content-Type: text/plain" --data-binary @output.hl7Both sides of a message meet on a correlation key. By default it is MSH-10 of the message. If the incumbent writes its own control id into its output, send the original one in the X-Correlation-Key header. In a Mirth HTTP Sender, set the header from the source message's MSH-10.
For a Mirth run you can skip the intake routes: choose Sync from Mirth. MedHook reads the channel's processed messages from the Mirth message API, stores each one's output, and runs the source message through the workflow in shadow mode. Run it again later; it picks up where it stopped.
5. Read the report
The report shows:
- the match rate: messages with no difference, out of the messages that have both outputs;
- the fields that differ, with the number and share of messages each one affects;
- the match rate per message type;
- under Messages that differ or wait, every message that differs or still waits for one side, with a short label for the message and the names of the fields that differ. Values are message content, so this list never shows them, whatever your role: a field name that could hold content shows as
[field], and a message MedHook's shadow run failed on reads "MedHook error: see the run's differences". Show the values in the run's differences opens them on Migration › Parallel runs, masked until you give a reason.
Fix the workflow, or add an ignore rule for a difference you accept, and choose Save and recompare: every stored message is compared again. Export CSV and Export JSON download the full report, with the values for roles that can see message content.
On Migration › Parallel runs, each differing field has Accept as expected and Fix in builder. Accept adds the field to the run's ignore rules, so later messages that differ only there are not counted until you cut over; the audit log records who accepted it and when. An accepted field keeps its card, with how many messages it differed in and one example, however rare the difference was. The example values are masked for every role. Show PHI asks for a reason, shows them, and logs the reveal.
6. Cut over
When the match rate holds where you need it, for long enough and across the message types you care about, cut over the interface: deploy the workflow, point the sender (or the passthrough) at it, and stop the incumbent channel. Close the run to stop it taking messages (Close run), and delete it when you no longer need the evidence. Delete asks first, with Delete run: the run and every message it stored are deleted, and the workflow and the old engine don't change.
On Migration › Parallel runs, Cut over is enabled once every difference is accepted, no message failed and the workflow was deployed; until it was deployed, Why cut over is held says so with Deploy the workflow. MedHook also recommends comparing enough traffic first: at least 100 messages, over at least 7 days, with at least one compared message of every message type the run has seen. These gates are recommendations, not a block, as Mirth and Rhapsody let you cut over at any time. While one is unmet, Why cut over is held lists each (for example "1 of 100 messages compared." or "No ADT^A08 message compared yet (3 seen).") and the button reads Cut over anyway: its checklist lists the unmet gates again and asks Why cut over now?, at least 10 characters, before Start delivering from MedHook is enabled. The reason and the unmet gates are recorded in the audit log as migration.cut_over_override, and on migration.cut_over. Anyone who may cut over may cut over anyway. In a sandbox workspace the gates only advise: they are listed under Recommended before cut over, Cut over needs no reason, and migration.cut_over lists them as advisoryGates. The run card follows the same gates: Ready, Held · 2 gates (or Held · 1 gate for a workflow never deployed), or Ready (overridable) when a sandbox's advisory gates are unmet. An operator can change the thresholds with MIGRATION_CUTOVER_MIN_MESSAGES, MIGRATION_CUTOVER_MIN_DAYS and MIGRATION_CUTOVER_MIN_PER_TYPE on the engine. Cut over opens a checklist in the order things happen: Start delivering from MedHook (confirming turns the workflow on, so MedHook listens before anyone moves), point the sender at MedHook (step 2 gives the workflow's listener address to send to, and Open drafted email gives you a plain-text email to copy and send yourself; MedHook never sends it), stop the old channel yourself in Mirth Administrator or Rhapsody, and keep it stopped, not deleted, for 30 days so you can roll back by pointing the sender back. While nothing has ever differed, the run reads "Every output matched so far. Ready to cut over." ("Every output matched for 7 days" once the run is 7 days old); once you have accepted every difference it reads "Every difference is accepted." Start delivering from MedHook closes the run and turns the workflow on in one step, and the audit log records it as migration.cut_over. If the cut over is done but MedHook could not reload its listeners, the run says so: "Cut over done, but MedHook could not reload its listeners. If messages do not arrive, restart the engine." The workflow must have been deployed first; if it was not, the checklist links to its deploy page. The interface's card then moves to Live on the board, with the day it went live. Only admins see Cut over enabled, as with deploying.
🎉 You have a measured, field-level comparison of the two engines on real traffic, before anything moved.
Troubleshooting
| Problem | Fix |
|---|---|
Channel status answers 400 with INCUMBENT_SSRF | The incumbent's host is private and not in SSRF_ALLOWLIST, or the URL is http:// for a host that is not listed. Add the host and restart the engine. |
Channel status answers 502 with INCUMBENT_AUTH, INCUMBENT_HTTP or INCUMBENT_NETWORK | The incumbent refused the login, answered with an error or could not be reached. Check the user, the API URL (Mirth's ends in /api) and the tunnel or firewall between the engines. |
An intake route answers 401 | The capture token is wrong, revoked or belongs to another run. Make a new one and update the incumbent's HTTP destination. |
An intake route answers 409 with RUN_FULL, or 413 | The run holds 10,000 messages, or the message is over 1 MB. Close the run and start a new one, or send smaller messages. |
Messages stay in awaitingIncumbent or awaitingMedhook | The two sides do not share a correlation key. Send the original MSH-10 in X-Correlation-Key on the side that changes it. |