pfx-api:loaddataFile
Load data from a file into Pricefx with support for batching, compression, and wait-for-completion strategies.
Overview
The loaddataFile method is a variant of loaddata designed for file-based imports. It reads data from a file (the exchange body or a file endpoint), applies a mapper, and bulk-loads it into Pricefx. It adds support for:
-
Wait-for-completion strategies -- wait for the server to finish processing before continuing the route
-
Batch tracking -- reports total records, failed records, and failed batches via exchange headers
-
File compression -- handles compressed input files
URI Format
pfx-api:loaddataFile?objectType=P&mapper=productMapper&businessKeys=sku&waitForCompletionStrategy=Always
Parameters
All parameters from loaddata are supported, plus:
|
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
Controls whether the route waits for the server to finish processing. See below. |
waitForCompletionStrategy Values
|
Value |
Behavior |
|---|---|
|
|
Fire and forget. The route continues immediately after the file is uploaded. No completion check is performed. |
|
|
Wait until the server reports completion. If the server reports a failure, an exception is thrown and the route stops. |
|
|
Wait until the server reports completion, but continue the route even if failures are reported. Failed record counts are available in headers. |
Staging
When using loaddataFile, the file is uploaded to the Pricefx staging area and then processed server-side. This means:
-
The file is transferred in a single upload
-
Server-side processing handles batching internally
-
You do not need to manually batch the data
Examples
Basic File Load
<route>
<from uri="file:input/products?noop=true"/>
<to uri="pfx-api:loaddataFile?objectType=P&mapper=productMapper&businessKeys=sku"/>
</route>
File Load with Wait-for-Completion
<route>
<from uri="file:input/data?noop=true"/>
<to uri="pfx-api:loaddataFile?objectType=P&mapper=productMapper&businessKeys=sku&waitForCompletionStrategy=Always"/>
<log message="Load completed. Total records: ${header.PfxTotalInputRecordsCount}, Failed: ${header.PfxTotalFailedInputRecordsCount}"/>
</route>
File Load Ignoring Failures
<route>
<from uri="file:input/data?noop=true"/>
<to uri="pfx-api:loaddataFile?objectType=P&mapper=productMapper&businessKeys=sku&waitForCompletionStrategy=AlwaysAndIgnoreFailures"/>
<choice>
<when>
<simple>${header.PfxTotalFailedInputRecordsCount} > 0</simple>
<log message="WARNING: ${header.PfxTotalFailedInputRecordsCount} records failed"/>
</when>
</choice>
</route>
Load Data Source from File
<route>
<from uri="file:input/datasource?noop=true"/>
<to uri="pfx-api:loaddataFile?objectType=DMDS&dsUniqueName=MyDataSource&mapper=dsMapper&businessKeys=sku,region&waitForCompletionStrategy=Always"/>
<to uri="pfx-api:flush?dataFeedName=MyFeed&dataSourceName=MyDataSource"/>
</route>
Headers Produced
|
Header |
Type |
Description |
|---|---|---|
|
|
|
Total input records processed across all batches. |
|
|
|
Total failed input records. |
|
|
|
Number of failed batches. |
Common Pitfalls
-
Using
Neverand expecting completion -- WithwaitForCompletionStrategy=Never, the route continues immediately. If you need to flush or run subsequent steps that depend on the data being loaded, useAlways. -
Not checking failure headers -- When using
AlwaysAndIgnoreFailures, always checkPfxTotalFailedInputRecordsCountto detect partial failures. Silent data loss is a common issue. -
Forgetting flush after DMDS load -- Just like
loaddata, if you load into a Data Source you must callpfx-api:flushafterward. -
File format issues -- Ensure the file format (CSV, etc.) matches what the mapper expects. Mismatched delimiters or encodings will cause silent data corruption or load failures.
-
Large file timeouts -- For very large files, the server-side processing may take a long time. If using
Always, ensure your route timeout is sufficient to cover the processing time.