Batch is a timing choice, not a quality level.
If an operation needs yesterday's approved records every morning, a complete file delivered at 2:00 a.m. may be more appropriate than hundreds of real-time calls. The important questions are whether the delivery is timely enough, whether the file is complete, and whether failure is visible before downstream work depends on it.
The file becomes an interface with a contract: name, cadence, encoding, delimiter, headers, identifiers, date and number formats, empty-value rules, trailer totals, encryption, retention, and who may reprocess it.
A dependable batch lifecycle
- 01
Create a stable export
Run the approved report, query, or CLI command using a defined time zone and cutoff. Write to a temporary name until the file is complete.
- 02
Deliver it securely
Move through SFTP or another controlled channel using service credentials, host-key verification, encryption where required, and least-privilege folders.
- 03
Recognize one complete arrival
Use an atomic rename, manifest, completion marker, or other handshake so the consumer never reads a file that is still being written.
- 04
Validate before processing
Check filename, age, size, headers, row widths, identifiers, required fields, types, duplicates, and control totals. Quarantine failures.
- 05
Load idempotently
Record a file fingerprint or batch identifier. Reprocessing the same file must not create duplicate customers, employees, invoices, or transactions.
- 06
Acknowledge and archive
Preserve the original, normalized output, processing result, counts, and errors under an agreed retention policy.
- 07
Monitor the schedule
Alert when a file is late, missing, unexpectedly small, unexpectedly large, rejected, or only partially accepted downstream.
The file contract
| Area | Question to settle | Evidence |
|---|---|---|
| Schedule | When is the file complete, in which time zone, and how late is late? | Expected and actual arrival timestamp |
| Identity | Is each file a full snapshot, incremental batch, or correction? | Batch ID, period, and source system |
| Structure | Which delimiter, encoding, headers, formats, and null rules apply? | Versioned sample and field specification |
| Completeness | What counts or totals prove the population? | Trailer, manifest, or independent control total |
| Security | How is the file encrypted and who may read or replace it? | Credential owner and access log |
| Recovery | Who may replay a file and what prevents duplication? | Runbook, approval, and idempotency record |
Warning signs in a proposed file feed
The producer can change columns without notice.
Add interface ownership, versioning, and a change-notification period.
The consumer watches only for a filename.
Also validate arrival time, contents, control totals, and prior processing.
Operators overwrite failed files by hand.
Quarantine originals and provide a logged, authorized replay path.
No one owns a missing file alert.
Name the first responder, business owner, and vendor escalation path.
The full file contains sensitive fields the target never uses.
Reduce the export to the minimum necessary data before transferring it.
