pfx-api:integrate

pfx-api:integrate

Upsert data into Pricefx using business-key matching. Existing records that match are updated; new records are inserted. Supports conditional updates.


Overview

The integrate method is the upsert operation for Pricefx. It compares incoming data against existing records using business keys:

  • If a matching record is found, it is updated

  • If no matching record is found, a new record is inserted

  • Optionally, a condition can restrict which existing records are updated

This is the preferred method when you need to keep Pricefx in sync with an external system without truncating and reloading.

URI Format

pfx-api:integrate?objectType=P&mapper=productIntegrateMapper&businessKeys=sku

Parameters

Parameter

Type

Default

Description

objectType

ObjectType

(required)

Target Pricefx object type.

mapper

String

--

Name of the integrate mapper bean. The mapper must implement IntegrateMapper.

businessKeys

String

(required)

Comma-separated business key field names used for matching.

condition

String

--

Name of a condition filter bean. Only existing records that match this condition are updated. Records that do not match are skipped (not deleted).

connection

String

--

Pricefx connection bean name.

converterStrategyType

MapperConverterStrategyType

--

Data auto-conversion strategy: MANUAL, AUTO.


integrateMapper

The integrate method uses an IntegrateMapper (not a LoaddataMapper). The integrate mapper defines which fields to map and how to handle updates vs inserts.

XML
<pfx:integrateMapper id="productIntegrateMapper">
    <pfx:field from="SKU" to="sku"/>
    <pfx:field from="PRODUCT_NAME" to="label"/>
    <pfx:field from="PRICE" to="attribute1"/>
</pfx:integrateMapper>

You can override the mapper at runtime by setting the integrateMapperPfx header on the exchange.


Condition

The condition parameter references a filter bean. When set, only existing records that match the condition are eligible for update. This is useful for:

  • Only updating records that have not been manually modified

  • Only updating records in a specific status

  • Protecting certain records from being overwritten

XML
<pfx:filter id="notManuallyEdited">
    <pfx:criterion fieldName="attribute10" operator="notEqual" value="MANUAL"/>
</pfx:filter>
XML
<to uri="pfx-api:integrate?objectType=P&amp;mapper=productIntegrateMapper&amp;businessKeys=sku&amp;condition=notManuallyEdited"/>

Examples

Integrate Products (P)

XML
<route>
    <from uri="direct:integrateProducts"/>
    <to uri="pfx-api:integrate?objectType=P&amp;mapper=productIntegrateMapper&amp;businessKeys=sku"/>
</route>

Integrate Product Extensions (PX)

XML
<route>
    <from uri="direct:integratePX"/>
    <to uri="pfx-api:integrate?objectType=PX&amp;mapper=pxIntegrateMapper&amp;businessKeys=sku"/>
</route>

Integrate Lookup Table Values (LTV)

XML
<route>
    <from uri="direct:integrateLTV"/>
    <to uri="pfx-api:integrate?objectType=LTV&amp;mapper=ltvMapper&amp;businessKeys=name&amp;pricingParameterName=MyLookupTable"/>
</route>

Integrate Matrix Lookup Table Values (MLTV)

XML
<route>
    <from uri="direct:integrateMLTV"/>
    <to uri="pfx-api:integrate?objectType=MLTV&amp;mapper=mltvMapper&amp;businessKeys=key1,key2&amp;pricingParameterName=MyMatrixTable"/>
</route>

Integrate with Condition

XML
<pfx:filter id="onlyActiveRecords">
    <pfx:criterion fieldName="attribute5" operator="equals" value="ACTIVE"/>
</pfx:filter>

<route>
    <from uri="direct:conditionalIntegrate"/>
    <to uri="pfx-api:integrate?objectType=P&amp;mapper=productIntegrateMapper&amp;businessKeys=sku&amp;condition=onlyActiveRecords"/>
</route>

Headers

Consumed

Header

Type

Description

integrateMapperPfx

IntegrateMapper

Overrides the mapper for this invocation.


Common Pitfalls

  1. Using LoaddataMapper instead of IntegrateMapper -- The integrate method requires an IntegrateMapper, not a LoaddataMapper. Using the wrong mapper type will cause a class cast error.

  2. Missing businessKeys -- Business keys are required for integrate. Without them, the component cannot match incoming data to existing records.

  3. Condition misunderstanding -- The condition only controls which existing records are updated. It does not prevent inserts. New records (no matching business key) are always inserted regardless of the condition.

  4. Performance vs loaddata -- integrate is slower than loaddata because it must check each record against existing data. For initial loads or full refreshes where you can truncate first, prefer loaddata for better performance.

  5. Business key mismatch -- The business key field names must match the fields in the Pricefx object. For example, Products use sku, Customers use customerId. Using the wrong field name will result in all records being treated as new inserts.