Ingestor runtime
The ingestor runtime is the part of ingestion that touches the outside world. It is a separate Java 25 process built on Apache Camel (and the FlowCatalyst application framework) that reads sources (SFTP, S3, SQS, RabbitMQ, polled databases and APIs, HTTP pushes, Camel routes and kinds that extensions add), splits payloads into records and sends the records to the platform, which turns them into dispatch jobs or events.
It holds nothing durable. Definitions, leases, cursors and watermarks, reports, failures and secrets all live on the platform and are reached only through the runtime API. A platform with no runtime simply has no ingestions running. The same process also hosts JVM functions.
The runtime contract
Section titled “The runtime contract”flowchart LR
subgraph RT["Ingestor runtime"]
RD["Round, every poll interval"]
WD["Lease watchdog, every second"]
RO["Camel routes per ingestion"]
L["HTTP listener :8091"]
end
RD -->|"POST /poll"| P["Platform<br/>/api/ingestion-runtime/v1"]
RD -->|"POST /report"| P
RO -->|"POST /ingestions/{id}/jobs"| P
RO -->|"GET, PUT /state/{id}/{key}"| P
RO -->|"GET /ingestions/{id}/secrets/{name}"| P
RD -->|"POST /leases/release"| P
RO -->|"POST /traces"| P
S[("Sources")] --> RO
C["HTTP callers"] --> L --> RO
The runtime authenticates as a service account holding platform:ingestion-runtime, a
platform-wide role: one fleet serves every client’s and application’s ingestions. Its calls:
| Call | Purpose |
|---|---|
POST /poll |
Every INGEST_POLL_INTERVAL (1 minute): which live ingestions to run, the lease length, pending connection tests. Carries contractVersion 2, the built-in kinds the runtime runs, the kinds its extensions add, and a per-process instanceId |
POST /report |
Route states, exchange counts, failures and test answers |
POST /ingestions/{id}/jobs |
The only way jobs are created. The runtime sends records; the platform builds each job from the ingestion’s own target (URL, pool, connection, signer, client), or stores an event per record for an event target |
GET, PUT /state/{id}/{key} |
A polled source’s watermark or cursor, kept on the platform so it follows the ingestion to another runtime |
GET /ingestions/{id}/secrets/{name} |
The only way secrets are read, and only those the live definition binds |
POST /leases/release |
Give back leases of routes that have actually stopped |
POST /traces |
Trace records, while tracing is on for an ingestion |
Every addition to the contract keeps version 2 and is ignored by an older platform. The poll answer
is read one ingestion at a time: an ingestion a runtime cannot read (a kind or field of a newer
platform) is reported FAILED with “definition not supported by this runtime version”, and the others
run. Exact shapes are in the runtime contract reference.
Kinds and ownership
Section titled “Kinds and ownership”| Kind | Runs on | Notes |
|---|---|---|
sftp, s3, database-poll, api-poll, extension kinds, camel-route |
One runtime at a time, under a lease | Polled sources: two readers would duplicate work and fight over cursors |
http, sqs, rabbitmq |
Every runtime that carries the kind | Push or competing-consumer sources: the broker or the load balancer spreads the work |
camel-route runs only where INGEST_CAMEL_ROUTES_ENABLED=true, and only anchor users can write one,
because a route runs with the runtime’s own network, identity and environment. See
custom Camel routes.
Leases, fair shares and fencing
Section titled “Leases, fair shares and fencing”stateDiagram-v2 [*] --> Unheld Unheld --> Held: a runtime's poll claims it (within its fair share) Held --> Held: each poll renews (lease 3 min) Held --> Released: route stopped cleanly, lease given back Held --> Expired: no renewal (runtime died or cut off) Released --> Held: another runtime claims it at its next poll Expired --> Held: another runtime claims it
- The lease lasts
FC_INGESTION_LEASE_SECONDS(3 minutes) and is renewed by every poll. The platform refuses to start with a lease under 2 minutes: a runtime polls every minute and must be able to stop a single-owner route before its lease ends. - Fair shares. For each polled kind, the live ingestions are spread evenly over the live runtimes that carry that kind. A runtime that alone carries a kind takes all of it. An ingestion a runtime has reported failing while another carrier has not is steered away from it; one that fails everywhere stays where it is, visible.
- Fencing on the platform. State writes and job creation check that the caller holds the lease,
inside the transaction, with the lease row locked, so a lease cannot expire and pass to another
runtime in between. A runtime that has lost its lease gets
409and can neither create jobs nor move a cursor. - Fencing in the runtime. A watchdog runs every second, apart from the poll round. Once a lease is within its margin of the end without a renewal (30 seconds or twice the poll timeout, whichever is longer, at most half the lease), it suspends the consumers reading those sources directly, without waiting for a round that may be stuck on a slow platform or a source that does not return.
- One runtime id, one process. Each process sends a random
instanceId. A second live process under the sameINGEST_RUNTIME_IDis refused with409 RUNTIME_ID_IN_USE: it renews nothing, its single-owner routes are stopped by the watchdog, it sends no reports, its readiness fails, and it keeps polling until the other is gone. - A runtime id belongs to one service account. The first poll registers the id to the service
account that made it, and a call naming that id from another account is refused with
403 RUNTIME_ID_NOT_OWNEDon every runtime route, release included. The binding ends when the runtime has been unseen for 7 days, after which the id can be registered again.
fc_ingestion_unheld (counted every minute on every platform replica) shows live polled ingestions no
runtime has held for a lease and two minutes: the signal that the fleet is too small or unhealthy.
Stopping and shutting down
Section titled “Stopping and shutting down”A route is stopped gracefully, and the routes a round stops are stopped together:
- Stop taking. The consumer reading the source is suspended at once. A batch ends after the exchange in flight; what the batch did not reach stays with the source (a file not moved, an SQS message not deleted).
- Finish. Each route gets up to 10 seconds, in parallel, to finish its exchange in flight (jobs sent, file moved, message acknowledged, watermark stored).
- Remove. Routes are stopped and removed one after another; one that has not finished gets a second more and is cut off, and its payload stays with the source.
A lease is given back only for a route that has actually stopped, with nothing still running in
it. At shutdown the runtime closes the function host, stops every route, gives back the clean ones
once with goodbye: true (so the platform hands them to another runtime at its next poll and stops
counting this one as live), then ships the last trace records. The budget fits inside the framework’s
app.shutdown.drain (20 seconds in the image). Anything not given back runs out with its lease, at
most 3 minutes after the last poll; watermarks live on the platform and idempotency keys absorb any
repeat.
Running out of memory ends the process (-XX:+ExitOnOutOfMemoryError) so it restarts healthy.
Idempotency keys
Section titled “Idempotency keys”Every record’s job carries externalId: the SHA-256 of the identity of the payload it came from
and the record’s position in it. The platform answers a record sent again under the same key with
the job it made first (keys are kept 7 days), so a payload read twice (a retry, a redelivered message,
a file not moved, the ingestion moving to another runtime) makes its jobs once.
| Kind | Identity |
|---|---|
sftp |
Host, absolute path, modified time and size |
s3 |
Bucket, key and ETag |
sqs |
Queue URL and message id |
rabbitmq |
Queue and the message-id property, when the publisher sets one |
database-poll |
The ingestion and the key column value (status track), or the watermark value and position (watermark track) |
api-poll |
The request with its cursor; no key without a cursor |
http |
The caller’s Idempotency-Key header; no key without one |
Extension kinds, camel-route |
Whatever the extension or route supplies |
The key is made from where the payload came from, never from its content alone. The jobs of one
payload also share a message group, <ingestion id>: plus the start of the identity’s hash, so a
payload read again lands in the same group. Because SQS keeps a message up to 14 days and the platform
keeps keys for 7, give every SQS source a dead-letter queue.
When the platform refuses jobs
Section titled “When the platform refuses jobs”| Answer to a jobs request | Treated as | What happens to the payload |
|---|---|---|
A client error it would repeat (any 4xx except 401, 403, 408, 409, 425, 429), or a refusal of a record |
Permanent | Let go of: a file moves to .rejected, an SQS message is deleted, a RabbitMQ message dead-letters, a cursor moves past it, an HTTP caller gets 422 REFUSED. Reported as REJECTED with the platform’s message |
5xx, no answer, 408, 409 (a lease or a paused target), 425, 429, or 401/403 after the token was dropped |
Transient | Sent again after 0.5 s and 1.5 s; after the third failure the source keeps the payload and offers it again |
Requests are cut at the ingestion’s batchSize (at most 1,000) and at 8 MiB of JSON; the platform
takes 10 MiB.
Which addresses a source may reach
Section titled “Which addresses a source may reach”Every host a definition names (SFTP and RabbitMQ hosts, JDBC URLs, API and token endpoints) is
resolved, and every address it resolves to is checked when the route starts and again before each
connection. Loopback, link-local (where cloud metadata answers), unspecified addresses and the known
metadata addresses are refused, including inside IPv4-compatible and NAT64 IPv6 forms; loopback is
allowed only when APP_ENV is local or test. Private ranges are allowed, unlike the platform’s
outbound delivery guard, because sources commonly live inside the network. Clients resolve through the
JVM’s cache, so a name re-pointed between the check and the connection (DNS rebinding) does not get
through. S3 and SQS, extensions’ own connections and Camel routes are not checked.
An sftp source must have a known host key; without one the route does not start unless the
definition sets acceptAnyHostKey: true, which is logged as a warning every time it starts.
Secrets
Section titled “Secrets”A secret is a platform configuration property of the ingestion’s application, at the ingestion’s
client. The platform answers a secret only when the live definition binds it, the runtime carries the
kind, it holds the lease (for a polled source) and the client is active. Each fetch is logged as
security telemetry and counted (fc_ingestion_secret_fetch_total); a refused fetch is audited.
Fetched values are kept for INGEST_SECRETS_CACHE_TTL (1 minute) and re-read on that cadence; when one
changes, the route is rebuilt, so a rotated password is picked up without a restart. A fallback reads
env: secrets from the runtime’s own environment (INGEST_SECRET_V2_<client>__<name>).
Failure pacing
Section titled “Failure pacing”A failure that repeats is paced and logged once, so a broken source or an unreachable platform
cannot cause a tight retry loop or flood the log. After n failed polls in a row a polled source waits
5 s × 2^(n-1) (at most 5 minutes, with jitter, never less than its own interval). While the platform
is not taking jobs every ingestion is held the same way (or by the platform’s Retry-After) and one
probe tests it. Each failure is logged in full the first time and then at most once a minute with a
count; Camel’s own repeated log lines for the same failure are turned down. See
failures are paced and visible.
Traces
Section titled “Traces”While an operator has tracing on for an ingestion (a time-boxed window, sampled), the runtime records polls, exchanges, HTTP calls and errors and ships them to the platform. Everything passes through a redactor before a record exists: header values, query values and body fields whose names look like credentials are replaced, a URL’s user info is dropped, every query value except paging and time-window parameters is replaced (an API may carry a password in a parameter of any name), and the secret values the runtime fetched for the ingestion are replaced wherever they appear. Extensions can mark further values to conceal. See tracing is gated and time-boxed.
The HTTP listener
Section titled “The HTTP listener”HTTP_PORT (8091) serves HTTP ingestions at POST /ingest/{client}/{code} (or
/ingest/{application}/{client}/{code} when two applications share a code for the client), plus
/health/live and /health/ready. A request is checked in order: the login (bearer, basic or a
FlowCatalyst token), the ingestion’s rate limit, the media type (415), the body (400 for empty or
malformed content; a DOCTYPE is refused outright), then the headers (X-Message-Group,
X-Correlation-Id). It answers 202 only after the platform has the jobs, with the job or event ids;
503 means send it again, and with an Idempotency-Key a resend gets the same ids. An address that
fails to log in 20 times in a minute against one ingestion is answered 429 without its credentials
being checked. Readiness fails while the platform has not answered a poll for three intervals. See
accept data over HTTP.
Extensions
Section titled “Extensions”A jar in INGEST_EXTENSIONS_DIR (or pinned by INGEST_EXTENSIONS_MANIFEST in S3, checksummed) adds a
source kind. Each jar has its own class loader that sees the runtime’s contract, extension API and
Camel, and must declare Ingestor-Extension-Api: 1 in its manifest; the runtime refuses to start with a
jar of another major version. A polled extension source is suspended, not interrupted, when its route
stops. See write an extension.
JVM functions
Section titled “JVM functions”With INGEST_FUNCTIONS_ENABLED=true (the default) the runtime also hosts jvm
functions: it long-polls the function control plane for its pool
(INGEST_FUNCTIONS_POOL), loads the jvm versions, and serves /fn/{address}[@alias|@vN]/{path} on
the same listener, with per-function permits, deadlines, a log rate limit
(INGEST_FUNCTIONS_LOG_RATE, 100 lines a second) and shared database pools. Its service account then
also needs platform:function-runner, and the platform routes jvm deliveries to it through
FC_FUNCTIONS_RUNNER_URL_JVM. INGEST_INGESTION_ENABLED=false makes a functions-only process. See
JVM functions are hosted by the ingestor.
Configuration
Section titled “Configuration”| Variable | Default | Effect |
|---|---|---|
FLOWCATALYST_BASE_URL |
http://localhost:8080 |
The platform; must be https outside local development |
FLOWCATALYST_CLIENT_ID, FLOWCATALYST_CLIENT_SECRET |
required | The runtime’s service account |
INGEST_RUNTIME_ID |
runtime-<hostname> |
This runtime’s name; never shared by two live processes |
INGEST_POLL_INTERVAL |
PT1M |
Poll and report cadence |
INGEST_CAMEL_ROUTES_ENABLED |
false |
Run camel-route ingestions |
INGEST_EXTENSIONS_DIR, INGEST_EXTENSIONS_MANIFEST |
unset | Extension jars |
INGEST_SECRETS_CACHE_TTL |
PT1M |
Secret cache and re-read cadence |
INGEST_TRACE_QUEUE |
2000 |
Trace records waiting to ship (at most 16 MiB) |
INGEST_FUNCTIONS_ENABLED, INGEST_FUNCTIONS_POOL, INGEST_INGESTION_ENABLED |
true, default, true |
Roles of this process |
HTTP_PORT, HTTP_HOST |
8091, 0.0.0.0 |
The listener |
APP_ENV |
local (the image: production) |
production refuses a plain-http platform and loopback sources |
Every value is also a key in config/application.yaml, which the jar needs in its working directory.
On the platform side, FC_INGESTION_ENABLED mounts the routes and FC_INGESTION_LEASE_SECONDS sets
the lease. Fleet sizing, rolling restarts and failover are in
running ingestor runtimes.