Define, test and go live with an ingestion
This guide takes one ingestion from nothing to live: an SFTP drop of CSV files, one dispatch job per row. The steps are the same for any source kind. For what an ingestion is, read Ingestion first.
Before you start
Section titled “Before you start”| You need | Why |
|---|---|
A platform with FC_INGESTION_ENABLED=true (always on under fcdev) |
Off, the ingestion routes answer 404 |
| An ingestor runtime that carries the source kind | The platform stores definitions; only a runtime reads sources. See Ingestion under fcdev locally |
An application of type INTEGRATION |
It owns the ingestion; a job code must start with the application’s code |
| A client | Every ingestion belongs to exactly one client |
| A dispatch pool and, usually, a connection | The target is resolved when you save, so they must exist first. See Configure pools and connections |
| Permissions | platform:ingestion:ingestion:create and update; promote to make a version live; test for test connection. The seeded role platform:ingestion-admin holds all of them |
1. Write the definition
Section titled “1. Write the definition”A definition is a YAML file. This one reads CSV files from an SFTP directory every five minutes:
application: ingest # an INTEGRATION applicationclient: acmecode: orders-sftp # unique within (application, client)name: Orders over SFTPsource: kind: sftp host: sftp.example.com directory: /in/orders username: feed credential: name: sftp-password # the NAME of a secret, never the value knownHosts: sftp.example.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... every: PT5Msplit: kind: csv header: true # first row names the columnstarget: code: ingest:orders:order:received targetUrl: https://hooks.example.com/orders pool: orders # a dispatch pool code connection: orders-conn # a connection code; its service account signs mode: NEXT_ON_ERROR batchSize: 100Points that catch people out:
- Secrets are names. A source never holds a secret.
credential: {name: sftp-password}is a reference; you set the value separately (step 3). - SFTP must say who the server is. Give
knownHosts(aknown_hostsline) or setacceptAnyHostKey: true, not both. With neither, the runtime refuses to start the route and reports itFAILED. Accepting any host key sends the credential to whoever answers, so it needs thebind-secretspermission. - The job code’s first part is the application’s code.
ingest:orders:order:receivedis valid for applicationingest. A code of another application is a400at save. - Everything in the target resolves at save. An unknown pool or connection, or a private-network
targetUrl, is refused when you save, not when a runtime tries it at night. - Unknown fields are errors. A typo in a key fails the save.
To make each record an event instead of a job, use target: {kind: EVENT, code: <event type>, batchSize: n}
and let the event type’s subscriptions decide where it goes. See
Accept data over HTTP for worked EVENT examples. The full field list is in the
definition reference.
Where the file can differ per environment
Section titled “Where the file can differ per environment”A definition file is the same in every environment. If the delivery address, a vendor login or an organisation id differs, leave it out and let the source name a settings entry:
source: kind: api-poll config: orders-feed # or `config: true` for the ingestion's own codeA source with config holds nothing else. See Definition files and sets.
2. Check, then apply
Section titled “2. Check, then apply”Refer to an ingestion as application/client/code (here ingest/acme/orders-sftp) or by its ing_ id.
Use a profile to pick the platform (Work against a remote platform).
fcdev ingest apply ./ingestions --set acme --dry-runfcdev ingest apply ./ingestions --set acmeapply takes a folder (every *.yaml and *.yml in it; the set is named after the folder unless
--set says otherwise). A dry run does every check and writes nothing. It prints a plan:
set acme, dry run: nothing was changed, 1 definition(s) create ingest/acme/orders-sftpYou can also create one in the console under Ingestions (/ui/ingestions) or with
POST /api/ingestions. The file route is preferred because it is repeatable and reviewable.
What state it is created in
Section titled “What state it is created in”The file’s active field has three states: true, false or absent. When absent, an ingestion whose
source names a settings entry is created paused (its settings come after the apply), and any other
is created active. An existing ingestion keeps its state. When active is stated, every apply
enforces it.
Draft or live
Section titled “Draft or live”Making a version live needs platform:ingestion:ingestion:promote. A caller without it saves a
draft: the version exists but no runtime receives it. The answer’s save field says what happened
(SAVED, MADE_LIVE, DRAFT, DRAFT_EXISTS, UNCHANGED). A set apply makes its versions live. Someone
holding promote makes a draft live from the Versions tab, with fcdev ingest live <ref> <version>, or
POST /api/ingestions/{id}/versions.
3. Set the secrets and settings
Section titled “3. Set the secrets and settings”The sftp password is a secret of the ingestion’s client. Set it on the platform configuration page:
application = the ingestion’s application, section secrets, property = sftp-password, client = the
ingestion’s client, type SECRET. See Manage configuration and reveal secrets.
The ingestion’s drawer lists each secret it binds as Set or Missing and links to the form.
If the source names a settings entry, write it now:
fcdev ingest config set ingest/acme/orders-feed orders-feed.json --secrets--secrets prompts (hidden) for each secret the entry uses. Nothing is written unless every ingestion
naming the entry accepts the value.
4. Test the connection
Section titled “4. Test the connection”fcdev ingest test ingest/acme/orders-sftp --waitA test tries the source once from a runtime’s own network, with its own secrets, and dispatches
nothing. It is pull-based: a runtime takes it at its next poll, so a result can take up to a minute
(15 seconds under fcdev). It needs platform:ingestion:ingestion:test because it makes a real
outbound call.
| Status | Meaning |
|---|---|
PENDING |
No runtime has taken it |
RUNNING |
A runtime is trying the source |
DONE |
Answered, with outcome RESULTS, NO_RESULTS, REFUSED, FAILED or NOT_SUPPORTED, the steps taken and how many records the split makes |
EXPIRED |
No runtime answered in time |
fcdev ingest test exits 1 for FAILED, REFUSED, NOT_SUPPORTED or no answer. NO_RESULTS is not
a failure: the source answered and had nothing. If no live runtime carries the kind, the test says so.
The source has not failed; nothing is trying it. The console has the same test on the ingestion form
and drawer.
5. Resume and watch
Section titled “5. Resume and watch”fcdev ingest resume ingest/acme/orders-sftpResume is refused with 409 while the settings entry the source names is not set
(INGESTION_CONFIG_NOT_SET) or a secret it binds has no value (INGESTION_SECRET_MISSING, naming the
secrets). Fix those and resume again.
Then check, in this order:
- Activity (
/ui/ingestions/{id}/activity): the last poll, counters for 24 hours and 7 days (polls, completed, failed, records, jobs) and the runtimes. “Polling, nothing new” means polls are happening and finding nothing. - Dispatch jobs: open the job list filtered by the job code. Each record is a job; see Find, requeue, redrive, cancel and edit dispatch jobs.
- Failures tab: anything the runtime could not take.
If it is quiet or red, go to Troubleshoot ingestion.
Changing it later
Section titled “Changing it later”Every change saves a new version. Edit the file and apply again: a change plan saves the next live
version. Pause and resume need update and keep versions and state. While a set owns an ingestion it is
read-only in the console and API (pause and resume still work); change the file instead.