Move large files and bulk datasets without heroics — land raw and immutable, validate structure and control totals before anything downstream sees a record, stream rather than buffer, and make every run restartable from the point it failed instead of from the beginning.
Bulk Data and File Integration: Secure, Restartable Pipelines
Objective: Build file and bulk data movement that behaves predictably at three in the morning. Most file integrations work until the day a partner sends four times the usual volume, or the connection drops at ninety percent, or a header changes silently — and then someone reloads from the top and hopes nothing double-posts. This plan lands data immutably, validates before it propagates, streams instead of buffering, and treats restart and reconciliation as design requirements rather than as an incident response.
What's Getting Built
- File Landing and Ingest (System API) — picks up completed files over SFTP/AS2/cloud storage and lands them raw and immutable with arrival recorded ·
SFTP LIST/READ, MARKER-FILE check, PUT landing/{partner}/{file}, POST /arrivals
- Validate and Reconcile (Process API) — validates structure and control totals and checks the checksum before any record propagates ·
POST /validate, POST /reconcile, POST /reject
- Streamed Transform and Load (Batch flow) — streams and chunks the file with a checkpoint per chunk and isolates per-record errors ·
BATCH chunkSize 50000, CHECKPOINT per chunk, ROUTE error-store
- Checkpoint and Rejected Rows (Object Store) — holds the last committed checkpoint offset and rejected-row references for restart and replay ·
GET /{runId}/checkpoint, PUT /{runId}/checkpoint, PUT /{runId}/errors
- Absence and Expiry Monitor (Scheduler) — fires when an expected file misses its arrival window or a partner credential nears expiry ·
SCHEDULER per arrival window, POST /alerts/absence
- Bulk Interface (target) — delivers idempotently on a natural key and polls the bulk job to completion rather than assuming success ·
POST /bulk-job, GET /bulk-job/{id}/status
Prerequisites
- Anypoint Platform org with a deployment target sized for the largest file you actually receive, not the average one.
- Object storage or a filesystem for the landing zone, with retention agreed against the reconciliation window.
- Transport access — SFTP, AS2, or cloud storage — with key management and rotation owned by a named team.
- Agreed file contracts per partner: layout, encoding, control totals, naming, and delivery schedule in writing.
- A target system whose bulk interface characteristics are known, including its idempotency behavior.
Choose your path
- Land and load — Choose when the target is a warehouse or lake — land raw, validate, and load with minimal transformation, keeping the raw file as the record of what arrived.
- Transform and distribute — Choose when files feed applications rather than analytics, which means per-record validation, error routing, and idempotent delivery per target.
Platform notes
File transports
- Never process a file that is still being written — require a marker file, a rename on completion, or a size-stable check before pickup.
- Partners resend, sometimes with the same name and different content; key idempotency on content or a declared sequence number rather than on filename alone.
Mule runtime
- Stream rather than materialize: a file that fits in memory today will not next quarter, and the failure mode is an outage rather than a slowdown.
- Use batch processing for per-record error isolation, so one bad row routes to an error queue instead of failing the run.
Targets
- Bulk interfaces usually have their own governance limits and asynchronous job semantics — poll for completion rather than assuming submission means success.
- Confirm the target's idempotency behavior before designing restart; a target that cannot deduplicate forces the pipeline to.
Architecture
1. Business requirements
- Every file that arrives is accounted for — processed, rejected, or explicitly waived, with none silently skipped.
- A failed run resumes from where it stopped rather than from the beginning.
- Bad data is isolated per record instead of failing an entire load.
- Volume growth handled by design rather than by increasing the memory allocation each quarter.
2. Landing and immutability
- Copy the file to a landing zone unchanged and treat it as immutable from that moment.
- Detect completeness before pickup with a marker file, rename, or stability check.
- Record arrival with partner, filename, size, checksum, and receipt time as the file's identity.
- Alert on an expected file that does not arrive, which is a more common failure than a malformed one.
3. Validation and control totals
- Validate structure and encoding before any record propagates, and reject the file rather than half-loading it.
- Reconcile declared record counts and control totals against what was parsed, and stop on mismatch.
- Check the checksum against a previously received file to catch accidental resends before they double-post.
- Report rejections to the partner with the specific reason and the offending line, not a generic failure.
4. Streaming transformation
- Stream through transformation so memory use stays flat as file size grows.
- Process in chunks with a checkpoint per chunk, which is what makes restart possible.
- Isolate per-record errors to an error store with the row and reason, letting the rest of the run complete.
- Keep transformation logic free of cross-record state wherever possible, since state is what breaks restart.
5. Delivery, restart, and reconciliation
- Deliver idempotently using a natural key or a declared sequence, so a replayed chunk cannot duplicate rows.
- Resume from the last committed checkpoint on failure, and make manual restart a documented operation rather than a rediscovery.
- Reconcile source count, transformed count, delivered count, and rejected count for every run, and publish the four together.
- Archive the raw file for the agreed window so any dispute is settled against what actually arrived.
6. Security and operability
- Encrypt in transit and at rest, and require key-based authentication for SFTP rather than passwords.
- Decrypt PGP-protected files inside the integration layer and never write the decrypted copy outside the controlled landing zone.
- Restrict landing zone and error store access by role; a file store is where sensitive data accumulates unnoticed.
- Rotate partner credentials on a schedule with an owner, and alert before expiry rather than after a failed transfer.
- Purge on the retention schedule automatically, because manual purging of file stores never happens.
Sample payload — Run manifest with reconciliation
{
"runId": "RUN-2026-0731-0412",
"partner": "distributor-north",
"file": {
"name": "SALES_20260731_0400.csv",
"sizeBytes": 4831221904,
"checksum": "sha256:9f2c...b41d",
"receivedAt": "2026-07-31T04:06:12Z"
},
"declared": { "recordCount": 8412990, "controlTotal": 19284431.55 },
"parsed": { "recordCount": 8412990, "controlTotal": 19284431.55, "match": true },
"progress": { "chunkSize": 50000, "chunksCommitted": 168, "lastCheckpoint": "offset:8400000" },
"outcome": { "delivered": 8411204, "rejected": 1786, "errorStoreRef": "s3://errors/RUN-2026-0731-0412/" },
"status": "completed_with_rejections"
}
Testing and validation
- Kill the run at ninety percent and confirm it resumes from the last checkpoint without reprocessing committed chunks.
- Deliver a file whose control total disagrees with its contents and confirm nothing propagates downstream.
- Resend an identical file and confirm the checksum check prevents a double load.
- Include malformed rows and confirm they route to the error store while the remainder completes.
- Quadruple the file size and confirm memory stays flat, proving the path is streamed rather than buffered.
- Withhold an expected file and confirm the absence alert fires on schedule.
Phased rollout
Phase 1 — Connect
- Stand up the landing zone with arrival recording and absence alerting for one partner, processing nothing.
- Agree file contracts and control totals in writing with that partner before building validation.
Phase 2 — Map and validate
- Implement validation and streamed transformation, running in parallel with the existing pipeline and comparing outputs.
- Prove restart from checkpoint deliberately, in a test that is kept as a regression.
Phase 3 — Production
- Migrate partners in waves, keeping the old pipeline available until reconciliation is clean for a full cycle.
- Hand run reconciliation and absence monitoring to operations with per-partner ownership.
Success metrics
- Files accounted for, with none silently skipped, evidenced by the run register rather than assumed.
- Runs recovered by checkpoint restart rather than by full reload.
- Rejected records as a share of volume, trending down as partner contracts are enforced.
- Peak memory flat as volume grows, which is the proof the pipeline scales.
- Time from file arrival to downstream availability, measured at the largest file rather than the median.
Troubleshooting
- Partial file processed — Likely cause: pickup started while the partner was still writing. Fix: Require a marker file or size-stability check before the file is eligible for pickup.
- Out-of-memory on an unusually large file — Likely cause: payload materialized rather than streamed, often by an incidental size or sort operation. Fix: Keep the whole path streamed and move any operation that needs the full dataset into the target.
- Duplicate rows after a restart — Likely cause: restart from the beginning against a target with no idempotency. Fix: Checkpoint per chunk and deliver on a natural key so replay overwrites rather than appends.
- A missing file goes unnoticed for days — Likely cause: monitoring watches for errors, and a file that never arrives produces none. Fix: Alert on expected-arrival windows per partner, independently of processing.
Deliverable: A file pipeline that lands raw and immutable, validates structure and control totals before propagation, streams and checkpoints through transformation, delivers idempotently, and reconciles source, transformed, delivered, and rejected counts on every run.