pfx-api:loaddataFile
LoaddataFile is used to process big data files and load them into a partition. You can use Excel or CSV format, GZIP, ZIP, or raw format. IM takes data from the file, validates them, splits them into batches if needed, compresses them, and sends them to the partition.
Data can be loaded into a partition in two ways:
Sync immediately returns the result of the operation.
Async returns the job of the operation when it is completed. Async load creates one or more jobs on the partition and lets the partition process them. You can check the status of the job via Unity UI – Job/Task Tracking. Optionally, IM can wait for the job to be completed. In that case, you need to use the right
waitForCompletionStrategy
andasyncTimeout
.
Properties
Option | Type | Default | Description |
---|---|---|---|
| string | Â | Defines a mapper name which is a Spring bean or definition in the header or property. |
| object |  | Defines the object type. Possible values are listed at Type Codes. |
| string |  | Defines a connection to Pricefx. This is an optional parameter and if it is omitted, the connection is taken from the Spring bean named pricefx. |
| string | Â | Defines the Price Parameter name for lookup table values. |
| number | Â | Defined the Price Parameter ID for lookup table values. |
| Boolean |  | Defines whether join fields definitions should be taken from the server. |
| string | Â | Defines the business key. |
| string |  | Defines the maximum length of business keys. Provide here a comma-separated list where the number of values must be the same as number of business keys. Sum of lengths must be less than or equal to 1024. |
| number | 5000 | Defines the number of records to be processed in a single batch. The default value is 5000 but it should be adjusted based on the number of the records and memory available on the machine. The value of 5000 is there because it is used also for fetch where it is recommended to fetch data in chunks of 5000 rows. For loaddataFile is recommended to use a much higher value, such as from 100 000 to 500 000. |
| Boolean | false | Defines if the load will be done asynchronously or not.
|
| number | 30000 (ms) | This parameter is applied only if |
| enum | Never | This parameter is used only when
|
Job/Task Tracking
The following overview is available in Unity UI:
Examples
loaddataFile Sync
The following code describes how to use loaddataFile sync.
<loadMapper id="productMapper" includeUnmappedProperties="false">
<body in="sku"/>
<body in="name" out="label/>
</loadMapper>
<routes xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:create"/>
<to uri="pfx-io:streamCompressedFile"/>
<to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true"/>
<to uri="pfx-api:loaddataFile?batchSize=500000&mapper=productMapper&objectType=P"/>
<log message="Done"/>
</route>
</routes>
loaddataFile for extension objects
The following code describes how to use loaddataFile for extension objects. Note that you have to use useReusableParser=true
option in pfx-csv:streamingUnmarshal
.
<loadMapper id="pxMapper" includeUnmappedProperties="false">
<body in="sku"/>
<body in="name" out="label/>
<constant expression="SamplePX" out="name"/>
</loadMapper>
<routes xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:create"/>
<to uri="pfx-io:streamCompressedFile"/>
<to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true&useReusableParser=true"/>
<to uri="pfx-api:loaddataFile?batchSize=500000&mapper=pxMapper&objectType=PX"/>
<log message="Done"/>
</route>
</routes>
loaddataFile async without Waiting
<loadMapper id="productMapper" includeUnmappedProperties="false">
<body in="sku"/>
<body in="name" out="label/>
</loadMapper>
<routes xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:create"/>
<to uri="pfx-io:streamCompressedFile"/>
<to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true"/>
<to uri="pfx-api:loaddataFile?batchSize=500000&async=true&mapper=productMapper&objectType=P"/>
<log message="Done"/>
</route>
</routes>
loaddataFile async and Wait for Jobs to Complete
Â
IntegrationManager version 5.8.0