17 File Flows

File Flows

Much of what an older integration platform does is moving files: a payroll system drops a file on an SFTP server at night, a bank picks one up, a partner delivers a CSV that some system has to load. Built one by one, each of those is a hand-written route with its own build and deployment, a password but no check of the server's host key, and no history beyond the route's own log events. File flows is KLK017's one standard way instead: a file flow is configuration, not code. It is a record in the tenant's ODL that the tenant's klok-file-transfer service runs, and a new partner file is a new flow here, not a new project.

  • In the menu: Run → File flows (/file-flows), with the tabs Flows and Transfers
  • For: the Tenant Admin, the Domain Admin of a flow's domain, and platform admins; developers do not see the pages, because a flow holds a partner's host, account and sealed credentials
  • Reads: the tenant's ODL (the flows, their status, every transfer and the service's sealing keys) with your own login, and the tenant's klok-file-transfer service for tests, host key scans, Run now and Resend; klok.dev's own database only for the revisions it keeps from the service's log events

What You See

A flow is one of three kinds:

Kind What it does
Move files Picks files up from a server or folder on a schedule and puts them on one or more others
Bring files into Klok Picks files up on a schedule and hands each one to the tenant's integrations as a KlokFileReceivedV1 event on the broker
Deliver files from Klok Puts a file an integration made on one or more servers, when the integration asks for it

The list has one row per flow: its kind, where it reads and where it writes, its schedule, its State as the service reports it, when it last polled and last found a file, its last error and how many files it picked up in the last 24 hours.

State Means Do
Running It runs the revision you saved Nothing
Running, with Rejected: … as the last error Your last save is invalid; the revision before it still runs Open the flow, read the reason, fix and save
Invalid The flow is invalid and nothing runs Open the flow and read the reason
Failing Valid, but it cannot start or poll: a host that does not answer, a refused login, a host key that does not match Fix the server side or the flow
Paused Runs once saved is off Switch it on and save
No status yet The service has not seen the flow Wait a minute; if it stays, the service does not run for the tenant

A flow's page shows its Status from the service (state, the revision applied and who saved it, the last poll, file, success and error, and the sealing keys of its secrets) above its parts: where the files come from, where they go, when it runs and what happens to the source file afterwards, with the whole flow summed up in one sentence beside them. Its own tabs are Flow, Transfers (its files) and Revisions (what the service made of each save in the last 72 hours). Transfers at the top searches every file of every flow, by flow, file name, state, sha256, label, correlation id and time.

Walkthrough: Fix A Failing Flow

  1. Open the flow marked Failing. Its Status says what failed; here the poll of the bank's SFTP server ends in JSchException: Auth fail.

  2. Choose Test connection. It connects to every end of the flow as it is saved, with the pinned host keys and the sealed credentials, and lists each folder: the destination answers, the source refuses the login.

  3. The bank has most likely changed the password. Choose Edit on the source, Replace the password and type the new one. When you save, klok.dev's server seals it with the public key of the tenant's klok-file-transfer, for this flow and this field; only the service can open it, and it is never shown again, never sent back to the browser and never seen by Kloker.

  4. Done, then Save. The page waits for the service: Revision 3 is applied, or the revision is rejected with its reason while the previous one keeps running. A failing flow is tried again at once when it is saved.

  5. Run now polls the source at once instead of waiting for the schedule, and the waiting file shows under the flow's Transfers.

Walkthrough: Send A Failed Delivery Again

  1. Under Transfers, type the file name (* and ? are wildcards) and press Enter, or filter by state.

  2. Open the transfer. Each destination shows its state, its attempts and its last error, here a refused write on Personec's server.

  3. When the cause is fixed, choose Resend to personec. The service delivers the transfer's staged copy again; the file does not have to come from its source once more. A staged copy is kept seven days unless the flow says otherwise, and a paused, rejected or failing flow resends nothing until it runs again. On an ingested file the button is Publish again.

Walkthrough: A New Flow From One Sentence

  1. Choose New flow, then Describe it to Kloker, and describe the flow as you would to a colleague: where the files come from, where they go, when, and what they are called. Draft the flow.

  2. Kloker fills in the draft: the kind, the schedule, the source and the destination, the file pattern and name, what happens to the source file, and a name. Every field it wrote says Kloker wrote this with Undo beside it, and Kloker's changes to check lists each answer with before and after, to Keep or Undo all. The summary beside the form says the flow in one sentence and lists what is still missing before it can be saved.

  3. What is left is yours. For each SFTP end, Scan host key, compare a fingerprint with the one the partner gave you over another channel, and only then choose It matches, pin it. Type each password.

  4. Save. The service starts the flow within seconds; a new flow's page shows its status after a reload. Run now fetches the first file at once.

What Happens In Git

Nothing on this page writes to Git. File flows are operational configuration that a tenant's operator changes, often in the middle of a migration from an older platform; in Git, every new SFTP account would be a merge request, a pipeline, a Vault write by a person and a restart. So the flow is a record in the tenant's ODL, and because its secrets are sealed, its JSON is safe to keep in Git as well, where a team wants that.

In klok.dev Where it lands Approved by By hand
Save The flow as a KlokFileFlowV1 record in the tenant's ODL, conditional on the version you read; its secrets sealed in klok.dev's server first. The service follows the change event and applies the new revision Nobody: the Tenant Admin or the flow's Domain Admin saves klok file-transfer seal for each secret, then a PUT of the record on the tenant's ODL API
Test connection, Scan host key, Run now, Resend Calls to the tenant's klok-file-transfer with your login. klok.dev stores nothing; the service records every file it moves as a KlokFileTransferV1 in the ODL — The same calls on the service's REST API
A flow kept in a repository klok file-transfer apply writes it to the ODL marked as managed by that commit; klok.dev shows it read-only, with a link to the commit Merged in that repository —

See What klok.dev Does In Git for every page.

Who Does What

Automation Kloker You
klok-file-transfer follows each flow's change event, checks the new revision and runs it, or rejects it with the reason while the previous one keeps running. It runs one route per enabled flow, polls on the schedule, stages each file, delivers it with retries, records it as a transfer and logs it, and compares every flow with what runs every five minutes. None of it uses AI Describe it to Kloker drafts a whole flow; Ask Kloker beside a part or a field fills it from plain words; Ask Kloker why it was rejected explains a rejected revision and writes the fix where it can. klok.dev's server checks every answer against the service's rules before you see it. Kloker never sees or sets a secret, never pins a host key, and never saves, tests, runs, resends or switches a flow on Compare and pin host keys, type and replace passwords, save, test, run now, resend and pause

See You, The Automation And Kloker.

How It Connects

File flows rests on the ODL (Operative Data), where the flows, their status and their transfers are records. Every transfer logs through the ordinary log events, so a file can be found in Logs and in OpenSearch Dashboards by its name, its flow or its checksum, and the flow's revisions come from those events. A flow that brings files into Klok publishes on a topic of the tenant's common domain, which has to be provisioned like any topic (Broker); until it is, the flow is Failing and its page offers Request the topic. An ingested file can start a run of its own (Process Runs). See How The Run Pages Fit Together.

Read More