Skip to content
Reference

Triggers

Every trigger type, its settings, how senders authenticate, and what the engine does with each message.

On this page

A trigger starts a workflow. A workflow has one trigger. Each type below lists its settings and the route or scheduler that feeds it.

TypeFed by
manualthe UI or POST /api/workflows/{id}/execute
webhookPOST /api/triggers/webhook/{webhookId}
cronthe engine's scheduler
schedulethe engine's scheduler (an alias of cron)
pollingthe engine's poller
mllpthe MLLP listener named in listener (default is TCP 2575; more in Helm mllp.listeners)
fhir-subscriptionPOST /api/triggers/fhir-subscription/{triggerId}
x12POST /api/triggers/x12, or the engine's SFTP pickup (sourceType: "sftp")
sftpthe engine's SFTP pickup: one run per file, or per CSV row
filethe engine's file pickup over a file, FTP/FTPS, SMB, WebDAV, S3 or SFTP profile
dicomthe DICOM listener (C-STORE on TCP 11112, Helm dicom.enabled)
jmsthe engine's JMS consumer on a queue or topic of a jms profile (AMQP 1.0)
soapPOST /api/triggers/soap/{listenerId} (SOAP 1.1 or 1.2), with its WSDL at ?wsdl
topica Publish to topic step in another workflow of the same workspace

A trigger only starts an enabled workflow. Production traffic runs the deployed version of the workflow, so a save after a deploy stays a draft until you deploy it.

Most inbound types accept a filter that drops messages before the workflow runs. See Filters.

Inbound deliveries are accepted, then processed. MLLP, webhook, X12, FHIR subscription, SFTP pickup and file pickup deliveries, and every cron or schedule tick, are written as durable pending executions first. The sender gets its answer (an ACK, or 200 with status: "accepted"), and then the work runner runs them on any replica. Nothing recorded means the sender is told to resend: AE over MLLP, 503 NOT_ACCEPTED with a Retry-After header over HTTP. That happens during a shutdown, on a failed database write, or when a workflow's backlog of pending executions reaches WORKFLOW_MAX_PENDING (5000 by default).

Ordering and holds

By default a webhook, X12, SFTP pickup, file pickup or FHIR subscription trigger runs its deliveries in parallel. MLLP always keeps order per sending facility.

SettingWhat it does
orderingnone (default) or fifo: one at a time, in arrival order, on every replica. MLLP has no ordering setting: it is always fifo per sending facility.
onErrorWith ordering: continue (default) runs the next message after a failure. hold stops that lane until the failed message succeeds or is skipped on Needs action.
deduplicateOn by default. A resend of a message already accepted gets the original outcome instead of running again. false runs every delivery, for senders that reuse their ids.

In the builder these are Ordering, On a failed message and Duplicate deliveries. The failed message that holds a lane waits on Messages › Needs action, and the medhook_lanes_held metric counts held lanes. Release a lane by replaying that message until it succeeds, or by skipping it there.

Manual

{ "type": "manual" }. The workflow runs when you start it. Use it for tests and for scripts that call the API. See Execute workflow and Run a workflow with a sample message.

Topic

{ "type": "topic", "topic": "adt.admit" }. The workflow runs once for every event another workflow publishes to the topic, in the same workspace. Each subscriber gets its own durable pending execution, so a slow or failing subscriber never holds the others back. The run's input is the event as it was published. A failed run is retried at least the topic's number of times, then it is a dead letter on the topic's page, where you can replay it. See Topics.

Webhook

json
{
  "type": "webhook",
  "webhookId": "orders-example",
  "secret": "whsec_test_example",
  "expectedHeaders": { "x-source": "partner-a" },
  "filter": { "logic": "AND", "rules": [] }
}
SettingWhat it does
webhookIdRequired. The last part of the URL: /api/triggers/webhook/{webhookId}.
secretThe HMAC secret. With a secret set, every request must carry a valid signature.
expectedHeadersHeader names and the exact values a request must carry. With no secret, they are the sender's credential (an API key or bearer token).
pathNot used for routing. The Mirth export writes it as the HTTP Listener context path, and a Mirth import sets it. The builder shows it as Mirth export path.
senderFromWhere a JSON body names its sender: { "path": "organization.id" } or { "header": "x-sender-id" }. See JSON senders.
filterOptional rules on the body.
responseWhat the sender gets back. See Answering the sender.
ordering, onError, deduplicateSee Ordering and holds.

Partners call this route without an engine token. The route authenticates the sender itself. See Receive a webhook.

In the builder the webhook trigger shows its Webhook id, the read-only Receives at URL, Required headers (name: value, one per line), Answer the sender with, Duplicate deliveries, Ordering and Mirth export path. HMAC signing secret sets secret: it is write-only, and a saved secret shows as set, with Replace and Clear. On the workflow's Versions tab, the deploy checklist's Callers can authenticate row also offers Generate signing secret, which shows a new secret once. For an end-to-end example, see Send webhook events to an EHR as HL7v2 over an IPsec tunnel.

Signing

Sign the exact bytes of the request body with HMAC-SHA256, using the trigger's secret as the key. Send the lowercase hex digest in the x-hub-signature-256 header as sha256=<hex>.

bash
BODY='{"orderId":"ORDER0001"}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" -hex | sed 's/^.* //')
curl -X POST "$ENGINE_URL/api/triggers/webhook/orders-example" \
  -H "Content-Type: application/json" \
  -H "x-hub-signature-256: sha256=$SIG" \
  -d "$BODY"

The engine also accepts the signature in x-webhook-signature, and accepts the digest without the sha256= prefix. It compares in constant time. Compute the digest over the bytes you send, not over a re-serialized copy of the JSON.

Replay window

A signature over the body alone can be captured and sent again later. To stop that, sign a timestamp with the body. The engine refuses a signed timestamp that is more than timestampToleranceSeconds (300 by default) from its clock, in either direction.

With the header above, send the unix time in seconds in x-webhook-timestamp and sign <timestamp>.<body> instead of the body:

bash
BODY='{"orderId":"ORDER0001"}'
TS=$(date +%s)
SIG=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" -hex | sed 's/^.* //')
curl -X POST "$ENGINE_URL/api/triggers/webhook/orders-example" \
  -H "Content-Type: application/json" \
  -H "x-webhook-timestamp: $TS" \
  -H "x-hub-signature-256: sha256=$SIG" \
  -d "$BODY"

Only a signed timestamp is checked. If a sender sends x-webhook-timestamp but signs only the body, the request is accepted as before and its timestamp is ignored, unless the trigger requires a signed timestamp.

The engine also accepts Standard Webhooks (opens in a new tab) headers, which many webhook libraries send: webhook-id, webhook-timestamp and webhook-signature (v1, and the base64 HMAC-SHA256 of <webhook-id>.<webhook-timestamp>.<body>). A trigger secret that starts with whsec_ is base64-decoded to get the key, as those libraries do; any other secret is used as its bytes. The header can carry several space-separated signatures, and one match is enough. webhook-id doubles as the idempotency key when there is no Idempotency-Key header, so a replay of the same message inside the window runs nothing again.

Senders that sign the body only keep working, with or without a timestamp header. Set requireTimestamp: true (Signed timestamp: required in the builder) to refuse them.

SettingDefaultWhat it does
timestampToleranceSeconds300Most seconds a signed timestamp may be from the engine's clock (1 to 86400).
requireTimestampfalseRefuse a valid signature that carries no signed timestamp.

The engine checks the signature first, so only a sender that holds the secret learns why a request was refused. Keep the sender's clock synced (NTP).

SituationAnswer
The signature is missing or wrong403 INVALID_SIGNATURE
A valid signature, timestamp outside the tolerance401 TIMESTAMP_OUT_OF_TOLERANCE, with how far off it was
A valid signature, no timestamp, requireTimestamp: true401 TIMESTAMP_REQUIRED
A valid signature, timestamp not in unix seconds401 TIMESTAMP_INVALID
No secret, expected headers set, and one is missing or wrong401 INVALID_CREDENTIALS
No secret, and the caller is not signed in and has no token401 SIGNATURE_REQUIRED, whose remediation names both fixes
An unknown webhookId, no secret401 SIGNATURE_REQUIRED, the same as a known one without a secret

Each timestamp and credential refusal is written to the audit log as trigger.webhook.rejected with the code and reason, never the secret or the body.

A trigger with no secret accepts a request that carries its expected headers, or one from a caller the engine already authenticated, such as an engine bearer token. WEBHOOK_ALLOW_UNSIGNED=true turns that check off. Leave it off in production.

So a 401 SIGNATURE_REQUIRED has two fixes: send Authorization: Bearer <token> from an API client that can reach the workflow's workspace (exchange its key at POST /api/auth/token), or set an HMAC secret on the trigger and sign the raw body in x-hub-signature-256 (or x-webhook-signature). Built-in templates never carry a secret, so a workflow made from one takes the bearer token until you add one. Use the secret for senders that can't get an engine token.

API keys and bearer tokens

Many senders can't sign a body, but can send a fixed header. Give the trigger no secret and set the header in expectedHeaders. The header is then the sender's credential.

json
{
  "type": "webhook",
  "webhookId": "appointments-example",
  "expectedHeaders": { "authorization": "Bearer dh-example-token" }
}
bash
curl -X POST "$ENGINE_URL/api/triggers/webhook/appointments-example" \
  -H "Authorization: Bearer $SENDER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"appointmentId":"APT-0001","patient":"TESTPATIENT"}'

An API key works the same way: { "x-api-key": "dh-example-key" }. A request must carry every expected header of one trigger on the webhookId. Give each sender its own trigger, and so its own key, on one webhookId to tell them apart. A missing or wrong value is 401 INVALID_CREDENTIALS and runs nothing. The engine compares the values in constant time and never returns them.

A trigger with a secret still needs the signature. Its expected headers then only pick the trigger, as described in Expected headers.

Expected headers

expectedHeaders is a map of header name to value. Names are case-insensitive and values must match exactly. On a trigger with no secret they authenticate the sender, as described in API keys and bearer tokens. On a trigger with a secret, a signed request that is missing one, or carries a different value, does not match that trigger. The response is 200 with "matched": false, and no workflow runs. Use them to tell two senders apart on one webhookId, or as an extra shared secret.

The engine treats every expected-header value as a credential. It stores the header names with each execution and masks the values. See Masking.

Bodies and limits

Content typeWhat the workflow receives
application/json, application/fhir+jsonThe parsed JSON. A FHIR Bundle passes through unchanged.
application/fhir+ndjson, application/ndjson, application/x-ndjsonA collection Bundle with one entry per line.
text/*The text.
anything elseThe body read as JSON, or as text if it is not JSON.

A text body is decoded with the trigger's charset when it has one, else with the charset parameter of the request's Content-Type, else as UTF-8. The charset values are utf-8, iso-8859-1, windows-1252, ascii and msh-18 (the message's own MSH-18). A JSON or NDJSON body is always UTF-8.

A body over WEBHOOK_MAX_BODY_BYTES (10 MiB by default) is 413 PAYLOAD_TOO_LARGE. An NDJSON file over WEBHOOK_MAX_NDJSON_RESOURCES (1000 by default) is refused the same way, and a bad NDJSON line is 400 INVALID_NDJSON with its line number. Each webhook allows TRIGGER_RATE_LIMIT_PER_MINUTE requests a minute (600 by default). Rate limits count only signed or authenticated senders, so a forged request cannot use up a partner's quota.

The engine records the delivery, answers, and runs the workflow after the answer:

AnswerMeaning
200 { "status": "accepted", "executionIds": [...] }Recorded. The executions are pending and run next. errors lists workflows skipped at intake.
200 { "matched": false }No trigger took the delivery, for example a missing expected header.
400 BODY_SCHEMA_INVALIDThe body does not match the trigger's body schema. Nothing ran.
409 NOT_RUNA trigger matched, but its workflow is not deployed or enabled. Nothing ran. Resending does not help.
403 PHI_NOT_AUTHORIZEDThe workflow handles PHI and the license does not allow it.
503 NOT_ACCEPTEDNothing was recorded. Resend after Retry-After.

Validating the body

Set bodySchema to a JSON Schema, and the trigger runs only for a body that matches it. An API sender learns at once what to fix, instead of a run that fails later. In the builder it is Body JSON Schema.

json
{
  "type": "webhook",
  "webhookId": "appointments-example",
  "bodySchema": {
    "type": "object",
    "required": ["appointmentId", "sender", "patient"],
    "properties": {
      "appointmentId": { "type": "string", "pattern": "^APT-[0-9]{4}$" },
      "sender": { "type": "string" },
      "start": { "type": "string", "format": "date-time" },
      "patient": {
        "type": "object",
        "required": ["mrn"],
        "properties": { "mrn": { "type": "string", "minLength": 3 } }
      }
    }
  }
}

A body that does not match is 400, and nothing is recorded:

json
{
  "error": "The body does not match the webhook's JSON Schema",
  "code": "BODY_SCHEMA_INVALID",
  "problems": [
    "/patient/mrn: is required",
    "/start: must be a date-time (RFC 3339)"
  ]
}

Each problem is a JSON Pointer and what is wrong. It never repeats a value from the body. The answer lists at most 20.

The engine checks this part of JSON Schema: type (one type or a list), properties, required, additionalProperties (true or false), items, enum, const, minLength, maxLength, pattern, format (date, date-time, email, uuid), minimum, maximum, minItems and maxItems. $schema, title and description are allowed and not checked. A save with any other keyword, such as $ref or oneOf, is refused, so a schema never looks stricter than what the engine enforces.

When several triggers share a webhookId, each checks its own schema. The body runs every trigger it matches. The answer is 400 only when no trigger took it and a schema refused it.

HL7 batches

With splitBatches: true, an HL7 v2 body (it starts with MSH, FHS or BHS) is split into one execution per message, in the order of the body. The batch envelope (FHS, BHS, BTS, FTS) is removed, and ACK messages in the body are skipped. Each message is deduplicated on its own: on <Idempotency-Key>#<MSH-10>, or without the header on MSH-3, MSH-4 and MSH-10. A message that appears twice in one body runs once. A body with more than 500 messages is 413 BATCH_TOO_LARGE and nothing runs.

HTTP has no HL7 acknowledgment, so the answer is JSON with one entry per message:

json
{
  "received": true,
  "matched": true,
  "status": "accepted",
  "executionIds": ["…", "…"],
  "messages": [
    {
      "index": 1,
      "controlId": "C1",
      "status": "accepted",
      "executionIds": ["…"]
    },
    {
      "index": 2,
      "controlId": "C1",
      "status": "duplicate",
      "executionIds": ["…"]
    },
    {
      "index": 3,
      "controlId": "",
      "status": "rejected",
      "executionIds": [],
      "reason": "MSH-10 (message control ID) is empty"
    }
  ]
}

A rejected message has a malformed MSH or segment. Its reason never quotes the message. The trigger's response setting does not apply to a split batch.

Retries and duplicates

Send an Idempotency-Key header (or X-Idempotency-Key) that is the same on every retry of one event. A repeat does not run the workflow again. The answer is 200 with "duplicate": true and the original execution ids. If the repeat arrives while the first is still being recorded, the answer is 503 IN_PROGRESS with a Retry-After header (INBOUND_RETRY_AFTER_SECONDS, 30 by default). Retry after that time. A trigger can turn this off with deduplicate: false. Records of seen keys expire after INBOUND_DEDUP_TTL_HOURS (24 by default).

Answering the sender

The trigger's response.mode sets the answer to an accepted delivery. Error answers (401, 403, 409, 413, 429 and 503) are never changed.

ModeWhat the sender gets
accepted (default)200 with status: "accepted" and the execution ids.
customstatusCode (2xx, not 204 or 205), contentType and a body of up to 8 KiB. The body takes ${executionId}, ${executionIds}, ${webhookId} and ${duplicate}, never message fields.
destinationThe output of step nodeId once the run ends, with statusCode. The engine waits up to timeoutMs (1 to 60 seconds, 30 by default). Past that, 202 with timedOut: true, and the run goes on. A failed run, after the workflow's retries, is 502 with the execution id, never the error text. An output larger than WEBHOOK_MAX_BODY_BYTES is 502 RESPONSE_TOO_LARGE.
json
{
  "type": "webhook",
  "webhookId": "eligibility-example",
  "response": {
    "mode": "destination",
    "nodeId": "check-eligibility",
    "timeoutMs": 20000
  }
}

In the builder: Answer the sender with, then Status code (2xx; not 204 or 205), Content type and Body (up to 8 KiB) for custom, or Answer with the output of and Wait up to (seconds, 1-60) for destination.

  • destination applies when exactly one run was accepted. With more, the sender gets the accepted body.
  • A resend with the same Idempotency-Key and the same body gets the first run's answer. The same key with a different body is 422 IDEMPOTENCY_KEY_REUSED, and nothing runs.
  • Each replica holds at most WEBHOOK_SYNC_MAX_WAITERS (50 by default) waits. Past that, the sender gets 202 with deferred: true at once.
  • A load balancer or proxy in front of the engine needs an idle timeout longer than timeoutMs.

Answer from a Respond step

A Respond step (step type respond) answers the caller with MedHook's own response. Its input is the body. A webhook workflow with a Respond step, and no custom or destination response on its trigger, waits for the run and answers with the step. A Request and respond draft from New workflow starts with one, named Respond to caller.

FieldWhat it sets
statusCode2xx, 4xx or 5xx, 200 by default. Not 3xx, and not 401, 403, 409, 413, 429 or 503, which the webhook route answers itself.
contentTypeThe answer's content type.
headersExtra headers. Not the ones the engine sets, and not ones that act on the whole engine, such as CORS, HSTS, CSP or Location.
timeoutMsHow long the caller waits for the run, 1 to 60 seconds, 30 by default. Past that, 202 with timedOut: true.
errorStatusWhat a failed run answers, 4xx or 5xx, 502 by default.
  • A workflow has at most one Respond step, on a webhook trigger or on an MLLP trigger with ackMode: "respond", where it builds the sender's ACK (ACK from a Respond step). The validator refuses others.
  • If the trigger sets a custom or destination response, that answers instead, and the validator warns. A trigger set to accepted is overridden by the step, and the validator warns that the caller waits for the run.
  • In a channel the Respond step is a destination's send. With destinations that run in order and the Respond step last, its script reads an earlier destination's reply by that destination's name.

The path receiver

/api/webhooks/{path} takes any path. It matches the path to a webhook adapter profile and checks that profile's credential (header, query or signature). Then it runs workflows whose webhook trigger uses the path, or the profile id, as its webhookId. It answers like the trigger route: 409 NOT_RUN, 403 PHI_NOT_AUTHORIZED, 413 over WEBHOOK_MAX_BODY_BYTES, and 503 NOT_ACCEPTED.

It takes POST, GET, PUT, PATCH and DELETE, each with the same credential, limits and answers. A signature is over the body bytes, and over the empty body when there is none, as a DELETE often sends; the run's data is then {}. A run started by any method but POST has it in its input as method, beside headers, so a condition or script reads input.method (for example input.method === "DELETE"). A POST's input has no method. The trigger's filter reads the body only, as it does for headers.

Schedule and cron

Use cron for work that runs on a clock.

json
{
  "type": "cron",
  "cronExpression": "0 6 * * MON-FRI",
  "timezone": "America/New_York",
  "exclusionDates": ["2026-12-25", "2027-01-01"],
  "missedRuns": "run-latest"
}
SettingWhat it does
cronExpressionFive fields: minute, hour, day of month, month, day of week.
timezoneAn IANA zone. The scheduler uses the server's zone when you leave it out. A slot fires at that zone's local time.
exclusionDatesUp to 500 calendar days to skip (YYYY-MM-DD), in the trigger's time zone.
missedRunsWhat an engine that starts does with slots missed while no engine ran: skip (default), run-latest (the newest one) or run-all (each, oldest first). Catch-up reads only the last CRON_CATCHUP_WINDOW_HOURS (24) and runs at most CRON_CATCHUP_MAX_SLOTS (10), keeping the newest.

An expression that can never run, or an unknown time zone, is refused: saving the workflow returns 400 with an INVALID_CRON issue in details.issues, enabled or not, and deploy returns 409 with the same issue. An empty expression blocks only an enabled save. The builder shows the next three runs in the trigger's time zone, or why the expression never runs.

In the builder these are Cron expression, Timezone, Next runs, Skip these dates (YYYY-MM-DD, one per line, in the trigger's timezone) and Missed runs.

The scheduler runs a slot once, even with several engine replicas: each slot is claimed in PostgreSQL. A tick is written as a pending execution, so it waits behind WORKFLOW_MAX_PENDING like any delivery, and the workflow's retries apply. The run's scheduledAt is the slot, not the time it ran. Before it claims a slot, a replica reads the trigger from the database, so a replica that has not seen your latest deploy never runs an old version. The fastest schedule is once a minute. GET /api/triggers/cron lists every scheduled job with its next and last run, the same on every replica.

Advanced day-of-week patterns

The day-of-week field takes three patterns that standard cron lacks. Days may be names (MON to SUN) or numbers (0 for Sunday to 6).

PatternMeaningExample
#NThe Nth weekday of the month, N from 1 to 50 9 * * MON#2 is 9:00 on the 2nd Monday
#LThe last weekday of the month0 9 * * FRI#L is 9:00 on the last Friday
BBusiness days, Monday to Friday0 8 * * B is 8:00 on every business day

POST /api/triggers/cron validates an expression, a time zone and exclusion dates, and previews the next 5 runs after the exclusion dates. It saves nothing: the schedule lives in the workflow's trigger. See Cron.

The schedule type

schedule is an alias of cron. The same scheduler runs it, with the same once-per-slot rule.

json
{
  "type": "schedule",
  "cron": "0 */6 * * *",
  "timezone": "America/New_York",
  "exclusionDates": ["2026-12-25"],
  "missedRuns": "skip"
}

The expression is in cron instead of cronExpression. timezone, exclusionDates and missedRuns work as for cron. Executions show triggeredBy: "schedule". The built-in Scheduled FHIR Sync template uses it: every 6 hours it reads the 100 most recently changed Patient resources and writes them to the target. That is a bounded re-sync, not an incremental one. For an incremental sync, use a polling trigger with a cursorField.

To read every page of a REST API on a schedule, start from the built-in Scheduled REST API sweep template. Its Generic REST step has pagination in its params, so the one step follows every page and hands on { items, pagination }. A loop step with iterateOver: "$.items" then runs the steps inside it once per record. A loop runs at most 1000 items, so the template stops the read at maxItems: 1000. Each run reads the endpoint again from its first page. To read only new or changed records, use a polling trigger with the same profile, endpoint and pagination (see Polling and Poll a paginated REST API). For a large history, start a batch run (POST /api/batch-runs, see Large batches).

In the builder, select the Source step and set Trigger type to cron or schedule. The Nightly CSV census template is an example, with a timezone on its trigger.

Polling

A polling trigger reads an adapter on an interval and runs the workflow once for each new item it finds. Use it for a source that cannot push to the engine, such as a FHIR server without subscriptions or a REST API.

json
{
  "type": "polling",
  "interval": 300000,
  "adapterProfileId": "profile_example",
  "action": "search",
  "params": {
    "resourceType": "Patient",
    "searchParams": { "_lastUpdated": "gt{{cursor}}", "_sort": "_lastUpdated" }
  },
  "cursorField": "meta.lastUpdated",
  "idField": "id",
  "maxItemsPerPoll": 100,
  "startFrom": "now"
}
SettingDefaultWhat it does
intervalnoneRequired. Milliseconds between polls, at least 10,000 (10 seconds). The builder takes seconds and stores milliseconds.
adapterProfileIdnoneRequired. The adapter profile to read. It must be in the workflow's workspace.
actionsee belowThe adapter action. search when the adapter has it, as the FHIR adapters do, otherwise read.
params{}The action's parameters. Any string with {{cursor}} gets the stored cursor. Before there is a cursor, that value is left out.
itemsPathnoneA dot path to the list of items in the result. Leave it out when the result is a list or a FHIR Bundle, whose entries are the items.
idFieldidA dot path to each item's id.
cursorFieldnoneA dot path to a value that grows with each change, such as meta.lastUpdated or a sequence number. Only items past the stored cursor run.
cursorFormatnoneHow cursorField values are written when they do not sort as text, such as 11/12/2026 10:00:00. One of MM/DD/YYYY, MM/DD/YYYY HH:mm, MM/DD/YYYY HH:mm:ss, MM/DD/YYYY hh:mm A, MM/DD/YYYY hh:mm:ss A (12-hour with AM or PM), DD/MM/YYYY, DD/MM/YYYY HH:mm:ss, YYYYMMDDHHmmss (HL7 date/time), epoch-seconds or epoch-millis. See below.
maxItemsPerPoll100The most items one poll runs. The rest run on the next poll.
startFromnownow: the first poll records what is there and runs nothing. beginning: the first poll runs every item it reads.
filternoneAn inbound filter. An item it rejects runs no workflow, but the cursor moves past it, so it is not read again. If the filter's script throws, the poll stops before that item and records the error; the item is read again next poll.

Each item runs as its own execution. Its steps get { "triggerType": "polling", "triggerId": "...", "item": { ... }, "polledAt": "..." }, so code reads the item as input.item. The inbound filter reads the item itself. Run test runs a JSON sample the same way, as the item. See Pull from an API to HL7v2 over MLLP.

The Source step in the builder with the polling trigger chosen: the interval in seconds, the adapter profile, the search action, its JSON params, the items path, the max items per poll, the cursor field meta.lastUpdated, the id field and the first poll

Duplicates and the cursor

  • With a cursorField, an item is new when its cursor value is past the stored cursor. The duplicate key is the item's id plus its cursor value (id@cursorValue), so a later change to the same record runs again, and the same change never runs twice.
  • Without a cursorField, the engine remembers the last 5,000 ids it saw and skips those. An id that drops out of that list runs again if the source returns it. The builder warns you when the cursor field is empty.
  • Items that share one cursor value, such as a bulk load stamped with the same lastUpdated, are one group. The engine stores the cursor only after a whole group has run, and maxItemsPerPoll stretches to finish the last group, so a gt{{cursor}} filter never cuts a group in half.
  • The cursor moves past an item only after its execution has started. An engine that stops in the middle of a poll reads the item again on the next poll, and the duplicate key stops it from running twice.
  • Leave cursorFormat out when the cursor values sort as text or as numbers (ISO-8601 timestamps, sequence numbers). A date written another way, such as MM/DD/YYYY HH:mm:ss, sorts wrongly as text (01/01/2027 before 12/31/2026), so set cursorFormat to it. The engine reads each value in that format and stores the cursor as an ISO-8601 time, and {{cursor}} in params gets it back in the source's format (12/31/2026 23:59:59). A value without a zone is compared as the clock time it shows, never converted; an HL7 value with a zone is converted to UTC and sent back with +0000. An item whose value does not parse in the format is not run, and the poll logs how many there were, as for an item without the cursor field. A date-only cursor, such as MM/DD/YYYY, only sees whole days, so the source's filter must ask for items on or after the cursor date, not after it; the ids the engine remembers for that date skip the items that already ran.
  • When a loaded or fetched sample's cursor field holds such a date and Cursor format is still as is, the builder's Source step offers the cursor formats written that way, month first (MM/DD) and, where one exists, day first (DD/MM), and you choose the one your source uses. The builder reads only how the date is laid out, never its values, so it does not guess the order for you.
  • Changing the profile, the action, the cursor field, the cursor format or the id field starts the cursor again, and startFrom applies again. Changing params keeps it.
  • Every item that runs also leaves a duplicate receipt for 24 hours (INBOUND_DEDUP_TTL_HOURS), keyed by the item's id and its cursor value, so changing the trigger to start the cursor again still skips items that ran in that window. To run them again, use Poll from the beginning.

Poll from the beginning

To run items again that already ran, open the workflow's Settings, then Delivery, and choose Poll from the beginning on the Polling cursor card, then confirm. The engine forgets the cursor, the ids it remembers and the duplicate receipts of items already run. The next poll, within a few seconds, runs every item the source returns, whatever First poll says. It is the polling equivalent of resetting a Mirth channel.

The builder's Source step shows the same state on a Polling cursor line once the saved trigger polls, with the same Poll from the beginning and confirmation.

  • Items run again even if they were delivered before, so downstream systems receive them a second time.
  • A poll in progress is never interrupted: the reset answers that a poll is running, and you try again a few seconds later.
  • Operators and admins can reset; the audit log records workflow.poll_reset with how many receipts were forgotten.
  • The API is DELETE /api/workflows/:id/poll-cursor. GET on the same path returns the cursor state (whether a cursor is stored, how many ids are remembered, the last and next poll and the last error), never the cursor value itself.

Recent polls

Every poll is recorded, including one that found nothing new, so you can see that the poller is reading on schedule and getting items back. The workflow's Overview has a Recent polls card for a polling trigger:

  • A summary of the last 10 polls, such as Last 10 polls, about every 60 s: all OK · 25 items each · 0 new.
  • One row per poll, newest first: the time, the outcome, the items read, how many were new, how many had already run, how many the inbound filter rejected, how many pages were read, and how long the poll took. Show all lists up to the last 100.
  • Request on a row opens that poll's read in the connection's Calls tab: the request line, the masked headers and the response, masked the same way as every other call. The Calls tab tags a poll's read as poll, and Polls shows them alone.

The outcomes are:

OutcomeMeaning
OKThe poll read the source and ran its new items.
OK, no new itemsThe poll read the source and every item had already run, or there were none.
Starting point recordedThe first poll with First poll set to now: it recorded where the source is and ran nothing.
FailedThe read failed, a page was out of cursor order, a full page was stuck on one cursor value, or an item did not run. The row names which, never the error text.
WaitingThe workflow reached its max in flight during the poll. The next items are read once a run finishes.
SkippedThe poll read nothing: the backlog of pending runs was full, the workflow was at its max in flight, or the license or PHI protection blocked it.

The row's counts and outcome never include the cursor value, an item or error text, so viewers see them too. The read is one row per poll in the connection's call log, however many pages it follows: the first page's request and response, or the failing page's when the read failed, with the time of the whole read. The call log keeps each connection's calls and their bodies for 7 days (CALL_LOG_RETENTION_HOURS, at most CALL_LOG_MAX_ROWS calls per connection), so an older poll's Request link opens nothing.

Polls are recorded in the engine's event log, in the trigger family, and kept for EVENT_LOG_RETENTION_DAYS. With EVENT_LOG_ENABLED=false, or EVENT_LOG_FAMILIES without trigger, nothing is recorded and the card says so. The API is GET /api/workflows/:id/polls.

Paging

The engine reads one page per poll. Sort the read by the cursor field (_sort=_lastUpdated for FHIR), because servers page results even when you do not ask them to.

  • A FHIR page in cursor order runs everything except its last group, which may continue on the next page. That group runs on a later poll.
  • A FHIR page that has a next link but is not in cursor order runs nothing. The cursor stays where it is, and the poll records an error that asks for _sort=_lastUpdated. Moving the cursor would skip items on later pages.
  • A Generic REST read with pagination in its params follows every page in the one poll, up to maxPages (50 by default) or maxItems, and the poll runs items from all of them. See Poll a paginated REST API for the pagination modes and a worked setup.
  • Any other source that is not FHIR has no next link to detect. Its read must return every new item, or be sorted by the cursor field.

License and PHI

Before each poll reads anything, the engine checks the license and the PHI rules, the same as for any other trigger. A blocked poll reads nothing, writes workflow.license_blocked or workflow.phi_blocked to the audit log with triggerType: "polling", and tries again after the interval or 5 minutes, whichever is longer. Its cursor does not move.

One replica polls a workflow at a time. It holds a lease in PostgreSQL, so adding replicas never polls a source twice.

To be told when polls keep failing, add an alert rule of kind Polling is failing in Settings → Alert rules. It fires when Needs you lists the workflow, and resolves when a poll reads the source again. See Engine alert rules.

SFTP pickup

An sftp trigger picks files up from a folder on an SFTP server, like a Mirth File Reader. Each file runs the workflow once, or once per row of a CSV file.

json
{
  "type": "sftp",
  "sftpProfileId": "partner-sftp",
  "remotePath": "/incoming",
  "pollInterval": 60000,
  "filenamePattern": "roster-*.csv",
  "afterProcessing": "move",
  "processedPath": "/incoming/processed",
  "errorPath": "/incoming/errors",
  "minFileAgeMs": 10000,
  "batch": { "mode": "rows", "csv": { "header": true } }
}

These settings are shared with the X12 SFTP pickup.

SettingDefaultWhat it does
sftpProfileIdnoneRequired. The SFTP adapter profile to read with. Its host key must be pinned.
remotePathnoneRequired. The folder to pick files up from. Subfolders are read only with recursive.
pollIntervalnoneRequired. Milliseconds between pickups, at least 10000. The builder takes seconds.
filenamePattern*A glob on the file name (*, ?, [abc]).
filenameRegexfalsetrue reads filenamePattern as a regular expression that must match the whole name.
afterProcessingmovemove to processedPath, delete, or leave.
processedPathnoneRequired for move. Not the same folder as remotePath.
errorPathnoneWhere a file goes that is too large or (in rows mode) does not parse. Without it the file stays and the trigger records the error.
minFileAgeMs5000A file changed more recently than this may still be being written, and waits for a later pickup.
maxFileBytes10 MBA larger file, by the size the folder listing shows, is never downloaded. At most 100 MB. The X12 pickup defaults to 100 MB.
minFileBytes0A smaller file stays in the folder (Mirth's minimum file size).
sortBymodifiedmodified picks files up oldest first; name in name order; size smallest first.
maxFilesPerPollallAt most this many files per pickup (up to 10,000); the rest wait for the next one.
recursivefalsetrue also reads subfolders, up to 10 deep, never processedPath or errorPath. A moved file lands in processedPath by name.
ignoreDotfalsetrue skips files and folders whose name starts with ., such as a sender's temporary upload.
encodingutf8utf8, latin1 (ISO-8859-1), windows-1252, ascii, utf16le, or binary: the bytes as base64 (not with rows).
batch.modefilefile: one run per file. rows: one run per CSV row, or per fixed-width record with batch.fixedWidth.
batch.csv{}In rows mode, the CSV parse options. maxRows is at most WORKFLOW_MAX_PENDING.
batch.fixedWidthnoneIn rows mode, instead of batch.csv: the fixed-width layout. One run per record.
filternoneAn inbound filter, checked on each run's input. A run it rejects is not recorded.
ordering, onErrornoneSee Ordering and holds. With fifo, runs go one at a time, in pickup order and row order.

What a run gets

In file mode a run's input is { "triggerType": "sftp", "triggerId": "...", "file": { "name", "path", "size", "modifiedAt" }, "content": "..." }. A csv-parse, xml-parse or hl7v2-to-fhir step reads content directly, and so does an hl7: path in a field mapping. With recursive, file.name is the path below remotePath, such as site-a/lab.hl7. With encoding: "binary", content is the file's bytes as base64 and the input also has "contentEncoding": "base64". A destination can name its file after the picked-up one with ${originalFilename}.

In rows mode each row is a run: { "triggerType": "sftp", "triggerId": "...", "file": { ... }, "row": { "mrn": "TP-1", ... }, "rowIndex": 0, "rowCount": 3 }. Every row of a file is recorded together, in one transaction: all of them or none. A CSV that does not parse, or has more than maxRows rows, runs nothing and moves to errorPath.

Order of operations

For each file, oldest first:

  1. Skip it unless it matches the pattern, is at least minFileAgeMs old and minFileBytes big (and, with ignoreDot, does not start with .). Take at most maxFilesPerPoll files.
  2. If its listed size is over maxFileBytes, move it to errorPath without reading it.
  3. Download it. If the bytes read differ from the listed size, the file is still being written: run nothing, stop this pickup, and try again next time.
  4. Decode it with encoding, and in rows mode parse the CSV.
  5. Record the runs as pending executions.
  6. Only then move, delete or leave the file.

Duplicates and crashes

The engine remembers each file it has run by its name, size and modified time. That record does not expire while the file is in the folder, so a file left with leave, or one the engine ran but could not move yet, never runs again. A file with the same name but a new size or time is a new file. deduplicate: false does not change this.

The file moves only after its runs are recorded, so a crash never loses a file:

  • A crash before the runs are recorded leaves the file in the folder, and nothing ran. The next pickup runs it.
  • A crash after they are recorded, before the move, finds the file already run on the next pickup: it runs nothing and moves the file.
  • In the short window after the runs are recorded and before the file and each run (each row) are marked done, a crash means the file is read again once that unfinished work is treated as abandoned (after EXECUTION_STALE_AFTER_MS). The second read can record the file's runs a second time, so a file or row can run twice.

Pickup is at least once, like every trigger: a crash in that one window can run a file or row twice, and a crash anywhere else cannot. Make the workflow's writes safe to repeat (for example, update by an identifier rather than insert) if a duplicate would matter.

If a file has run but cannot be moved, for example because processedPath already has a file with that name (SFTP rename does not overwrite), the engine records the problem in lastError, leaves the file, and goes on to newer files. The next pickup tries the move again without running the file again. If the engine cannot record a file, for example because the workflow's backlog is full, the file stays and the pickup stops, so files keep their order.

Limits

Files are read whole, not streamed. A file is at most maxFileBytes (10 MB by default, 100 MB for the X12 pickup, 100 MB at most), and a CSV file split into rows has at most maxRows rows (10,000 by default, and never more than the pending backlog WORKFLOW_MAX_PENDING allows). For a larger CSV file, start a batch instead: it streams the file a chunk at a time.

One replica picks up at a time, holding a lease, as for polling triggers. License and PHI rules are checked before the folder is read.

File pickup

A file trigger is a Mirth File Reader over any scheme: it picks files up from the folder of an adapter profile, and the profile's adapter type is the transport. It has every SFTP pickup setting, with the same order of operations, duplicate protection and limits; only the profile field differs.

json
{
  "type": "file",
  "adapterProfileId": "lab-share",
  "remotePath": "/results",
  "pollInterval": 60000,
  "filenamePattern": "*.hl7",
  "afterProcessing": "move",
  "processedPath": "/results-done",
  "errorPath": "/results-error",
  "recursive": true,
  "ignoreDot": true
}
SettingWhat it does
adapterProfileIdRequired. A profile of one of the adapters below. Any other adapter type is refused at pickup.
everything elseAs for the SFTP pickup. A run's triggerType is "file".
ProfileNotes
Local File (file)A folder on a mounted volume. Paths are relative to the profile's baseDir, which must be inside FILE_ADAPTER_ROOTS. A move never replaces an existing file.
FTP / FTPS (ftp)A server without MLSD gets file times from MDTM; with neither, the file-age check passes at once and the size check alone catches a file still being written.
SMB (smb)Paths are relative to the share. SMB 2.x without encryption: keep it on a private network or VPN.
WebDAV (webdav)Paths are relative to baseUrl. A move is a MOVE that never overwrites.
Amazon S3 (s3)remotePath is a folder (key prefix) below the profile's prefix. A move is a copy and then a delete: a crash between them leaves both, and the next pickup copies it again (without running it) and deletes the original.
SFTP (sftp)The same as an sftp trigger.

MLLP

json
{
  "type": "mllp",
  "messageTypes": ["ADT^A01", "ADT^A04"],
  "sendingFacility": "FACILITY_A",
  "sendingApp": "EHR_A",
  "deduplicate": true
}
SettingWhat it does
messageTypesMSH-9 values to take. An empty list takes every type.
sendingFacilityTake only messages whose MSH-4 equals this.
sendingAppTake only messages whose MSH-3 equals this.
listenerThe MLLP listener (port) to take messages from, declared in Helm mllp.listeners. Omitted: default (mllp.port). A save that names an undeclared listener is refused.
ackModeaccept (default): ACK once recorded. destination: ACK from the destinations' outcome. respond: the ACK the workflow's Respond step builds. See ACK from the destination and ACK from a Respond step.
ackTimeoutMsdestination and respond modes: how long the ACK waits (default 20000, at most MLLP_TIMEOUT minus 5 s).
ackTimeoutCoderespond mode: the ACK when the run doesn't finish in time, AE (default) or AR.
ackOnFailurerespond mode: when a step after the Respond step fails, respond (default) keeps its ACK; AE answers AE.
splitBatchesSplit an HL7 batch (FHS/BHS, or several MSH in one frame) into one execution per message, answered with an acknowledgment batch. Not with ackMode: "destination" or "respond". See Batches.
charsetHow the frame's bytes are decoded: utf-8 (default), iso-8859-1, windows-1252, ascii, or msh-18 to follow each message's MSH-18. See Character sets.
binaryRaw TCP only: hand the received bytes on as base64 in rawMessage (with binary: true in the input) instead of decoding them as text.
onErrorcontinue (default) runs the next message from the facility after a failure. hold stops that facility's messages until the failed one succeeds or is skipped on Needs action.
filterOptional rules on the message. See Filters.
deduplicateOn by default. A resend with the same MSH-10 does not run again.

To convert HL7v2 to FHIR, add an hl7v2-to-fhir step (or a channel output of kind hl7-to-fhir). There is no trigger setting for it: a saved trigger that still has autoConvertToFhir loads, and the key is dropped.

Messages from one sending facility through one trigger always run one at a time, in arrival order, on every replica.

Message types match three ways: exactly (ADT^A01), with a structure on the message (ADT^A01^ADT_A01 matches ADT^A01), and by code alone (ADT matches every ADT event). A configured structure must match exactly.

The engine accepts a message by writing a durable pending execution for each matched workflow, then sends the ACK, then runs the workflows. With ackMode: "destination", the ACK waits for the workflows' destinations instead. See MLLP and ACKs. The listener calls POST /api/triggers/mllp. That route is internal. See MLLP listener ingest.

Raw TCP

A listener can take raw TCP as well as MLLP, as Mirth's TCP Listener does in Basic TCP mode. Your operator sets its framing in Helm mllp.listeners; the trigger picks the listener as usual. Under Docker Compose, set MLLP_LISTENERS in .env (the Compose file passes it to both the engine and mllp-server; a Compose file of your own must do the same): the engine takes raw data only from a listener it knows is raw, and refuses it otherwise (the sender then gets AE and retries forever).

yaml
mllp:
  listeners:
    - name: glucose-raw
      port: 7001
      framing: frame # mllp (default), frame or eos
      startBytes: "02" # hex, 0x02 or <STX>; may be ""
      endBytes: "03"
      response: ack # ack (default) or none
      maxConnections: 10
      idleTimeoutMs: 60000
Listener settingWhat it does
framingmllp (default): VT, message, FS CR. frame: startBytes, message, endBytes. eos: the message is everything until the sender closes its side of the connection (one message per connection).
startBytes, endBytesUp to 16 bytes each, as Mirth writes them: "0B", "1C0D", "0x1C 0x0D" or "<FS><CR>". Quote them in YAML. No start bytes: a message starts after the previous one ends. frame needs end bytes.
responseack (default): answer each message. none: answer nothing.
maxConnectionsConnections over the cap are closed at once and counted in medhook_mllp_connections_refused_total. Unset: no cap.
frameTimeoutMsClose a connection whose message is still incomplete this long after its first byte, however slowly the bytes arrive. The clock stops while the listener itself is busy forwarding earlier messages. Default: twice idleTimeoutMs for frame and eos; none for mllp. An eos sender that keeps one connection open longer than this (its message ends only when it closes) needs a larger value.
idleTimeoutMsClose a connection that sends nothing for this long. Default 300000 (5 minutes).

On a raw TCP listener, an HL7 message (it starts with MSH, FHS or BHS) is handled exactly as on MLLP and answered with an HL7 ACK in the listener's framing. Anything else is raw data: it reaches the trigger as rawMessage with content: "raw" and an empty messageType, and the listener answers with the engine's code, AA, AE or AR, as text in its framing. Raw data has no MSH, so only triggers on that listener with no messageTypes take it; their filter, charset, binary and onError apply. Data with a NUL byte, which cannot be stored as text, arrives as base64 with binary: true whatever the trigger says; an HL7 message with a NUL is answered AR. The engine takes raw data only from a listener declared with framing frame or eos.

Raw data has no message control id, so it has no dedup key: a sender that resends after an AE, or after its own timeout, runs the workflow twice for the same data, as in Mirth. Make the destination idempotent (a conditional create, an upsert) when that matters.

Every listener keeps the same limits: MLLP_MAX_FRAME_BYTES per message (over it, the connection is closed and nothing is recorded), the engine's ingest rate limit, and a pending execution recorded before any answer. A peer that does not read its answers is not read either, and its connection is closed once 1 MiB of answers is waiting. On a raw listener a message must also arrive in full within frameTimeoutMs. One listener process serves every port, so set maxConnections on each raw TCP listener.

DICOM

json
{
  "type": "dicom",
  "calledAeTitle": "MEDHOOK",
  "callingAeTitles": ["CT1", "MR2"]
}
SettingWhat it does
calledAeTitleTake only objects sent to this AE title. Empty takes every association the listener accepts.
callingAeTitlesTake only objects from these senders (calling AE titles). Empty takes every sender the listener allows.
storeProfileIdAn S3 adapter profile to keep the objects in. Omitted: the engine's DICOM store volume (DICOM_STORE_DIR).
filterOptional rules on the metadata below. See Filters.
ordering, onErrorSee Ordering and holds.
deduplicateOn by default. An object resent by the same sender with the same SOP Instance UID (after a lost response) does not run again.

The DICOM listener is a separate container (Helm dicom.*, Compose dicom-server), a C-STORE SCP like the Mirth DICOM Listener. It takes Verification (C-ECHO) and every standard storage SOP class, refuses an association that calls another AE title or comes from a calling AE title not in dicom.allowedCallingAeTitles, and forwards each object to the engine. The engine stores the object, then writes a pending execution for each matching trigger, and only then does the listener answer the C-STORE: Success once the runs are recorded, Out of Resources (0xA700, the sender resends) when nothing could be recorded, a processing failure when no trigger takes the object. The listener calls POST /api/triggers/dicom. That route is internal. See DICOM listener ingest.

What a DICOM run gets

The run's input is the object's metadata and a reference to it, never its pixel data:

json
{
  "triggerType": "dicom",
  "triggerId": "trg_ct_intake",
  "callingAeTitle": "CT1",
  "calledAeTitle": "MEDHOOK",
  "sopClassUid": "1.2.840.10008.5.1.4.1.1.2",
  "sopInstanceUid": "2.25.1001",
  "transferSyntaxUid": "1.2.840.10008.1.2.1",
  "studyInstanceUid": "2.25.1000",
  "seriesInstanceUid": "2.25.1000.1",
  "modality": "CT",
  "accessionNumber": "DEMO-ACC-0001",
  "patientId": "DEMO-MRN-0001",
  "studyDate": "20261001",
  "object": {
    "store": "local",
    "key": "2026/10/01/…",
    "triggerId": "trg_ct_intake",
    "iat": 1790812800,
    "exp": 1793404800,
    "sig": "…"
  }
}

The metadata comes from the first 1 MiB of the object's dataset. Fields the object does not carry are left out.

object is signed by the engine. A DICOM step reads the object back only when the reference is unaltered, has not expired, belongs to the run's workspace and was issued to the trigger that started the run. A reference copied into another trigger's input (a webhook body naming object, say) is refused, and so is one used after DICOM_STORE_RETENTION_DAYS (30 by default; 365 days when retention is 0). Treat the run's input as PHI all the same: the metadata holds the patient id and accession number.

Where objects are kept

On the engine's DICOM store volume (DICOM_STORE_DIR, Helm dicom.store) by default. Files are written with mode 0600 under a date folder and a random name, and every read checks the size and SHA-256 the reference recorded. DICOM_STORE_RETENTION_DAYS deletes date folders past the retention. Every engine replica may run the step that sends the object on, so with more than one engine replica the volume must be ReadWriteMany (the chart refuses to render otherwise), or set storeProfileId to keep objects in S3, where the bucket's lifecycle rules apply.

Who may send

An AE title is not authentication. It is a name the sender puts in its association request, and any host that can reach the port can claim any AE title. dicom.allowedCallingAeTitles and callingAeTitles route objects and catch misconfigured senders; they do not keep anyone out. Do this instead:

  • Restrict who can reach the port: dicom.networkPolicy.allowedCidrs and dicom.service.loadBalancerSourceRanges in Helm, a private network, or a site-to-site VPN.
  • On a network you share, turn on TLS with client certificates (mutual TLS, dicom.tls.requireClientCert). A client certificate proves the peer holds a key your CA signed. It is not tied to an AE title: any peer with a valid certificate can call with any AE title, so give certificates only to senders you trust with every trigger on the listener.

Without TLS, objects cross the network in clear text, and the listener logs a warning when it starts.

Limits

  • One object is at most DICOM_MAX_OBJECT_BYTES (128 MiB by default, on the listener and the engine). A bigger object aborts the association (A-ABORT), and nothing is stored.
  • The listener drops a connection that sends a PDU over 1 MiB, a DIMSE command over 64 KiB, any other dataset over the object cap, or a malformed P-DATA PDU. A peer has DICOM_ASSOCIATION_TIMEOUT_MS (10 s by default) from connecting to finish its association request, then DICOM_IDLE_TIMEOUT_MS (60 s) between PDUs.
  • Connections that have not associated yet are capped at DICOM_MAX_PENDING_CONNECTIONS (32) overall and DICOM_MAX_CONNECTIONS_PER_IP (8) per address, so silent connections can't take the slots a modality needs. An address is an IPv4 address, or an IPv6 /64 (one host usually holds a whole /64). Addresses written ::a.b.c.d and NAT64 addresses (64:ff9b::a.b.c.d) fall in one /64, so every IPv4 sender behind a NAT64 gateway shares one limit; raise DICOM_MAX_CONNECTIONS_PER_IP if that is how your modalities connect. These caps slow one source down; peers on many IPv4 addresses can still fill the pending pool. The real defence is who can reach the port: see Who may send.
  • An association lasts at most DICOM_MAX_ASSOCIATION_LIFETIME_MS (one hour by default), however active; then the listener sends A-ABORT and the sender reconnects for the rest. Mirth has no such limit; 0 turns it off.
  • DICOM_MAX_ASSOCIATIONS (10 by default, 4 in Helm) associations at once; past that the listener refuses an association with a transient reason, and the sender retries. An association that closes while its object is still being recorded stays counted until the engine answers (the engine call is cancelled when the sender goes).
  • One C-STORE at a time per association, as in Mirth: a sender that sends the next object before the answer waits until the listener has answered the first.
  • Objects held in memory are capped at DICOM_MAX_INFLIGHT_BYTES (512 MiB) across all associations. A C-STORE that would go past it is answered Out of Resources (0xA700), and the sender retries. Four slow senders, each with a large object in flight, can hold the whole budget until their associations end (DICOM_MAX_ASSOCIATION_LIFETIME_MS), as one association at a time can in Mirth; dicom.networkPolicy.allowedCidrs and a shorter lifetime are the mitigations.
  • While the engine records an object, the idle timeout is paused: the sender is waiting for the answer, so it is silent by design. DICOM_ENGINE_TIMEOUT_MS bounds that wait instead, and the idle timeout counts again from the answer.
  • Store only: no query/retrieve (C-FIND, C-MOVE, C-GET), worklist or storage commitment.

FHIR subscription

json
{
  "type": "fhir-subscription",
  "resourceType": "Patient",
  "criteria": "active=true",
  "interaction": "update"
}
SettingWhat it does
resourceTypeRequired. The resource to watch.
criteriaA FHIR search query added to the subscription, as Patient?active=true.
interactioncreate (default), update, delete or create-or-update (both creates and updates).
filterOptional rules on the resource.
ordering, onErrorSee Ordering and holds. A fifo lane is one per resource.
deduplicateOn by default. A repeat notification of the same resource version does not run again.

The engine creates a rest-hook subscription in the local Medplum server and points it at /api/triggers/fhir-subscription/{triggerId}. It adds a token header to the subscription, and the route accepts only callbacks that carry it (401 INVALID_TOKEN otherwise). The token comes from ENGINE_AUTH_SECRET, so after you rotate that secret the engine refreshes the subscriptions when it starts. Set FHIR_SUBSCRIPTION_SYNC_ON_STARTUP=false to turn that off. Every workflow save also updates the subscription. Until Medplum has the saved resource type, criteria and interaction, callbacks for the trigger are not run (they are audited as trigger.fhir-subscription.out-of-scope), and a resource of another type than resourceType never runs the workflow. A callback is recorded as a pending execution before the answer, and a resend of the same version answers duplicate: true. If nothing could be recorded, the answer is 503 NOT_ACCEPTED with Retry-After, and Medplum retries. See FHIR subscription callback.

X12

json
{ "type": "x12", "transactionSets": ["837", "835"], "sourceType": "webhook" }
SettingWhat it does
transactionSetsTransaction sets to take, such as 837, 835, 270, 271. Empty takes all.
sourceTypesftp, webhook or upload: which deliveries this trigger takes. The engine decides a delivery's source; a sender cannot claim one.
filterOptional rules on each transaction set's parsed view.
acknowledgmentsnone (default), 999, or 999+ta1. See below.
ordering, onErrorSee Ordering and holds.
deduplicateOn by default. A set that arrives again with the same sender, receiver, ISA13, GS06 and ST02 does not run again.

Documents arrive at POST /api/triggers/x12, as raw X12 text or as JSON with rawData. The engine reads the delimiters from the ISA segment and splits the interchange: each transaction set (ST to SE) runs once for every trigger whose transactionSets takes it. The run's input has transactionSet, controlNumber (ST02), interchangeControlNumber (ISA13), groupControlNumber (GS06), parsedData (that set's parsed view) and rawData (that set in its own ISA/GS/GE/IEA, so an x12-parse step reads it). A body without an ISA is refused with 400. A set that arrives again with the same sender, receiver, ISA13, GS06 and ST02 does not run again. deduplicate: false turns that off.

The source is webhook for a request with a token and upload for a file uploaded from the dashboard. A sourceType in the body or an x-medhook-source-type header is ignored.

With acknowledgments: "999", the answer carries a 999 for each functional group (AK1, AK2 and IK5 per set, AK9). With "999+ta1" it also carries a TA1 when the sender asked for one (ISA14 = 1) or the envelope is broken. Send Accept: application/edi-x12 to get the raw EDI instead of JSON. The checks are syntax only: control numbers, counts and a known transaction set. They do not validate against an implementation guide.

What the 999 or TA1 rejects never runs, whether or not the trigger asks for acknowledgments. A broken envelope (ISA13 not equal to IEA02, a wrong IEA01 or no IEA) records nothing. A group with a GE error skips every set in it. A set with a wrong SE01 or SE02 is skipped. The reasons are in errors. When nothing is left to run, the answer is 422 with status: "rejected", and an SFTP file moves to errorPath. The sender fixes the interchange and sends it again with new control numbers, so the rejected copy is never processed as well.

SFTP pickup for X12

With sourceType: "sftp" the engine polls a folder on an SFTP server for X12 files. It uses the SFTP pickup, with the same settings, order of operations and duplicate protection, and each file goes through the X12 intake:

json
{
  "type": "x12",
  "transactionSets": ["835"],
  "sourceType": "sftp",
  "sftpProfileId": "payer-sftp",
  "remotePath": "/outbound/835",
  "pollInterval": 300000,
  "filenamePattern": "*.x12",
  "afterProcessing": "move",
  "processedPath": "/outbound/835/done",
  "errorPath": "/outbound/835/errors",
  "ackPath": "/inbound/acks"
}

The settings are the SFTP pickup settings except batch, plus one. maxFileBytes defaults to 100 MB here, because payer 835 and 837 batches are often larger than 10 MB; a larger file goes to errorPath unread.

SettingWhat it does
ackPathWhere the 999 and TA1 go, as <file>.999 and <file>.ta1, when acknowledgments asks for them. They are written before the file is moved. If the write fails, the next pickup writes them without running the file again.

A file that is not X12, or whose 999 or TA1 rejects every set, runs nothing and moves to errorPath. A file whose sets no trigger takes runs nothing and is read again on each pickup.

For files that are not X12, use an sftp trigger. See Send an X12 document.

JMS

A jms trigger is a Mirth JMS Listener: the engine consumes a queue or topic through a JMS profile (ActiveMQ, Artemis, IBM MQ or another AMQP 1.0 broker).

json
{
  "type": "jms",
  "adapterProfileId": "lab-broker",
  "destination": "lab.results",
  "destinationType": "queue",
  "selector": "facility = 'DEMO'",
  "prefetch": 10
}
SettingWhat it does
adapterProfileIdRequired. A jms profile: the broker, login and TLS.
destinationRequired. The queue or topic name.
destinationTypequeue (default) or topic.
subscriptionNameTopics only. A durable subscription under the profile's clientId (or medhook-<workflow id> when it has none): the broker keeps messages while no engine is connected. Unset: a plain consumer that misses them.
selectorA JMS message selector the broker applies, up to 1000 characters.
prefetchMessages the broker sends ahead of their acknowledgement, 1 to 100 (10 by default). Cut so prefetch times JMS_MAX_MESSAGE_BYTES stays under 128 MiB.
filter, ordering, onError, deduplicateAs for the other inbound triggers. With ordering: "fifo" the runs keep the queue's order.

One engine replica consumes each trigger, chosen by a lease it renews every 10 seconds on its own timer (a slow broker connect never delays it); when it stops, another replica takes over within a minute. A message is acknowledged to the broker only after its run is recorded, so a crash before that leaves it on the broker, which redelivers it. The JMS message id is the run's duplicate key, so the redelivery does not run twice. A message the filter drops is acknowledged without a run.

When nothing can be recorded (a shutdown, a database error, a full backlog, a license or PHI block, a disabled workflow), the message is released back to the broker and the consumer reconnects after a backoff of 1 second doubling to a minute. A message over JMS_MAX_MESSAGE_BYTES (10 MB by default) is rejected without being read, so the broker dead-letters it: the engine takes frames of at most 64 KiB (a broker that sends a larger one is disconnected with amqp:connection:framing-error before the frame is read) and stops buffering a message once it passes the cap.

A run's input has destination, destinationType, messageId, correlationId, contentType, subject, replyTo, the message properties, redelivered and data. Text, XML and JSON bodies arrive as text (JSON parsed); any other bytes as base64 with contentEncoding: "base64"; a MapMessage as an object. Logs and the audit log name the destination, never message content or properties.

SOAP

A soap trigger is a Mirth Web Service Listener: a SOAP 1.1 and 1.2 endpoint at POST /api/triggers/soap/{listenerId}, with a WSDL at GET /api/triggers/soap/{listenerId}?wsdl. The generated WSDL describes Mirth's acceptMessage(arg0) operation under serviceName, so a Mirth sender's generated client works once it points at the new address.

json
{
  "type": "soap",
  "listenerId": "lab-intake",
  "serviceName": "LabIntake",
  "soapVersion": "both",
  "wsSecurity": "UsernameToken",
  "wsUsername": "lab-sender",
  "wsPassword": "••••"
}
SettingWhat it does
listenerIdRequired. The URL segment: letters, digits, - and _. Several triggers may share one; each checks its own credential and takes the requests that match it.
serviceName, namespaceThe WSDL's service name and target namespace. Default: Mirth's own service name (Mirth) and namespace.
soapVersion1.1, 1.2 or both (default).
operationsThe Body element names the trigger takes. Empty takes any.
wsSecurityUsernameToken requires a WS-Security UsernameToken with wsUsername and wsPassword: PasswordText, or PasswordDigest with a fresh nonce and a Created within 5 minutes.
secretAn HMAC secret, checked like the webhook's over the raw body.
wsdlA WSDL to serve instead of the generated one: well-formed XML without a DOCTYPE or processing instructions, rooted in a WSDL 1.1 definitions or WSDL 2.0 description. Elements and attributes in W3C namespaces must be WSDL, SOAP, XML Schema or WS-Addressing ones; XHTML, SVG, MathML, XSLT and XLink are refused, however the namespace is spelled. Service and vendor namespaces are fine.
response{ "mode": "accepted" } (default) answers once the run is recorded, naming the execution ids. { "mode": "destination", "nodeId": "...", "timeoutMs": 30000 } waits for the run and answers that step's output in the Body.
filter, ordering, onError, deduplicateAs for the webhook. A resend with the same Idempotency-Key header gets the original outcome.

Senders authenticate with the trigger's wsSecurity login, its secret, or both. With neither, only callers with an engine credential are accepted, as for a webhook without a secret. When several triggers share a listenerId, each checks its own credential, and a request runs only the triggers whose credential it satisfies. A request no trigger accepts is refused. The rate limit (TRIGGER_RATE_LIMIT_PER_MINUTE) counts authenticated requests; failed attempts have a budget of their own, so they can't lock the real sender out. The WSDL is public for a listener with its own credential and otherwise needs an engine credential too; it is sent with Content-Security-Policy: sandbox; default-src 'none' and X-Content-Type-Options: nosniff. wsPassword and secret are encrypted at rest and never returned by a read. A PasswordDigest nonce must be canonical base64 and is remembered by its bytes, per replica, for 10 minutes.

The envelope's version must match its Content-Type (text/xml for 1.1, application/soap+xml for 1.2). A body over SOAP_MAX_BODY_BYTES (5 MiB by default, configurable up to 50 MiB; see workflow limits) is refused with 413 before parsing. A DOCTYPE or entity declaration is refused as a Client fault, never expanded. Faults use each binding's status: 500 for SOAP 1.1, 400 (Sender) or 500 (Receiver) for 1.2. Nothing recorded answers 503 with Retry-After; a license or PHI block 403. A fault's text is fixed: never workflow error text or message content.

A run's input has listenerId, soapVersion, operation, soapAction, data (the text of Mirth's arg0, or the operation's content as JSON), bodyXml (the operation element), soapHeaders and the request headers with credentials masked. The wsse:Security header is never stored, and header blocks named like a credential are dropped.

Reference