Lattice file ingestion cleanup
What it does. Deletes fully processed file ingestion bundles, with their records and the stored copy of the file, once the connection's retention period has passed, and removes the connection's old records of ingested files. Runs: automatically once a day as a background process. Who looks after it: Integration administrator (the retention of each connection, and running it now); System administrator (the background process itself, on a standard page).
Purpose
Each file that file ingestion picks up becomes a bundle: the stored copy of the file, one segment per record and a record that the file was ingested (which is how a second copy of the same file is recognized and skipped). Once every record of a file has been processed, the bundle is only history. The cleanup removes it after the retention period you set on the connection, so stored files and segments do not pile up.
Without it, every stored file and every segment is kept forever, the file ingestion pages grow slower, and a connection you have retired can never be deleted, because a connection that still has bundles cannot be deleted.
When it runs
- Once a day, at about the time of day the process was first registered; set Next execution to change it. It is one process for the whole environment and covers every connection, enabled or not.
- The database synchronization of a Lattice deployment registers it, and process automation must be initialized in the environment. There is no batch job for you to create.
- Every poll creates a batch job named Lattice file ingestion cleanup; the process does not first check whether there is anything to delete.
- An Integration administrator can run the same job at any time with Clean up file ingestion bundles.
Configuration and scheduling
| Setting | Where | Default |
|---|---|---|
| How long a processed file is kept | System administration > Setup > Lattice > File ingestion > File ingestion connections, Schedule tab, Retention (days) (also on the last step of New file ingestion connection) | 30 for a new connection |
| How often and when it runs | System administration > Setup > Process automations, Background processes tab: select Lattice file ingestion cleanup and choose Edit, then Repeat interval and Next execution on the Execution parameters tab | Once a day |
| A time of day when it does not run | The same dialog, Sleep time period group | Not set by Lattice |
| Run it now | System administration > Periodic tasks > Lattice > Clean up file ingestion bundles | No fields |
- Retention (days) set to 0 keeps the connection's files forever; saving it shows "With a retention period of 0 days the cleanup never removes this connection's processed files, their records and their stored copies." A negative value is refused with "Retention (days) cannot be negative."
- The file sizes recorded for Wait until the file size is stable are removed after 7 days without a refresh, for every connection. This period has no setting.
- A deployment keeps the interval, next execution and owner you set. The process cannot be switched off; to keep it out of busy hours, set Enabled sleep period or Next execution in Edit.
- Process automations is a standard page that only the System administrator role opens. File ingestion connections (where Retention (days) is set) and Clean up file ingestion bundles need the Integration administrator role; the Integration operator can read File ingestion monitor and File ingestion operations.
How it works
- Find complete bundles. For every connection whose Retention (days) is above 0, the cleanup lists the bundles whose segments are all Processed. A bundle with a segment that is Queued, Failed or Held is skipped.
- Check the age. A bundle is old enough when it was received (its Received time, or when it was created if that is empty) more than Retention (days) ago.
- Delete the bundle. For each old bundle, in one transaction: the stored copy of the file (a document attachment) is deleted, then the bundle and, with it, its segments. If that fails, the transaction is rolled back, the failure is written to the ingestion log, and the cleanup goes on with the next bundle.
- Forget old files. For every connection whose Retention (days) is above 0, the records of files ingested more than Retention (days) ago are removed (the rows on the connection's Ingested files tab). A file with the same path and content that arrives after that is ingested as new.
- Remove stale sizes. File sizes recorded for Wait until the file size is stable that were not refreshed for 7 days are removed; their files are gone.
- Report. The run writes "File ingestion cleanup completed: %1 bundle(s) and %2 stored file(s) deleted, %3 record(s) of ingested files removed." to the ingestion log, with the numbers in place of %1 to %3.
Before it can run
- Process automation is initialized in the environment (System administration > Setup > Initialize process automations), Lattice was deployed with a database synchronization, which registers the process (a synchronization from Visual Studio registers nothing), and the batch service is running.
- At least one file ingestion connection with Retention (days) above 0; otherwise a run only removes stale file sizes.
- Bundles are complete only when the segment processor has processed every record. Process file ingestion segments is not a background process: it must be scheduled, or no bundle ever becomes complete.
- A license warning or block does not stop it.
Inputs and outputs
| What | Where you see it | |
|---|---|---|
| Reads | Each connection's Retention (days) | File ingestion connections, Schedule tab |
| Deletes | Complete bundles past retention, their segments and the stored copy of the file | File ingestion monitor; File ingestion operations workspace, Recent bundles and Segments tabs |
| Deletes | Records of ingested files past retention | File ingestion connections, Ingested files tab |
| Deletes | File sizes not refreshed for 7 days | Not shown on a page |
| Writes | One completion entry per run, and an entry for each failure | File ingestion operations workspace, Ingestion log tab; LatticeFileIngestLogs |
It raises no business event and changes no posted document: the documents the records created stay as they are.
Monitoring and logs
- System administration > Workspaces > File ingestion operations, Pipeline activity, Ingestion log tab: the completion entry (Level Information, no connection) with the counts, and an entry at Level Error for each bundle or connection that could not be cleaned.
- System administration > Setup > Process automations, Background processes tab: select the process and choose View most recent results. Each run shows "Lattice file ingestion cleanup finished.", or "Lattice file ingestion cleanup failed. The messages below give the reason; the process runs again at its next interval." with the messages.
- System administration > Inquiries > Batch jobs: the batch job named Lattice file ingestion cleanup, whose log also holds the completion message.
- File ingestion monitor: no bundle of a connection is older than its Retention (days) unless one of its segments is not Processed.
When it fails
A bundle that cannot be deleted is rolled back on its own and written to the ingestion log at Level Error, with its connection and bundle: "Failed to clean up processed bundle.", and the reason in Details. The other bundles are still cleaned, and the bundle is tried again on the next run. A connection whose old ingested-file records cannot be removed is logged as "The records of ingested files of this connection could not be removed." Because these errors are handled inside the job, View most recent results still records the run as finished, so read the ingestion log. The batch framework does not retry the run.
| Symptom | Cause | Fix |
|---|---|---|
| Stored files and bundles are not removed | The process is not running (process automation not initialized, Lattice deployed without the database synchronization that registers its processes, or the batch service stopped) or has not run yet, the connection's Retention (days) is 0, or a segment of the bundle is not Processed | Check the process, the retention and the bundle's segments on File ingestion monitor |
| A bundle stays for good although its file was handled | One of its segments is Failed or Held | Release a Held segment on File ingestion monitor, or retry the record's dead letter so the segment is processed. A record whose dead letter was discarded stays Failed, and no page deletes its bundle, so that bundle and its stored file are kept |
| "Failed to clean up processed bundle." in the ingestion log | The stored file or the bundle could not be deleted | Read Details; the bundle is tried again on the next run |
| A connection cannot be deleted | It still has bundles | Disable the connection; the cleanup removes its complete bundles once their retention has passed |
| A file that was sent before was ingested again | Its record of ingestion was older than Retention (days) and had been removed | Expected; keep Retention (days) longer than the time in which a partner may resend the same file |
Effect on the rest of Lattice
- Duplicate protection lasts as long as the retention. The record that a file was ingested is what makes a second copy of the same file (same path and content) be skipped. Once the cleanup removes it, the same file is ingested and processed again.
- After a bundle is deleted you can no longer open its stored file or its segments on the file ingestion pages; the ingestion log entries stay until the integration log cleanup removes them (90 days by default).
- A bundle is complete only when the segment processor has processed every record, so the cleanup depends on Process file ingestion segments being scheduled, and on failed records being resolved.
- Deleting a large backlog of stored files after a long time without a run can take a while; move Next execution to a quiet hour if needed.
Related
- I want to set up a file ingestion connection
- I want to follow a file from arrival to posting
- I want to check that the Lattice background processes are running
- File ingestion user guide
- Scenario: inbound file to posted document
- Page reference: File ingestion connections
- Lattice integration log cleanup