Overview
Pricefx fires events when certain operations complete (e.g., PA data load, CFS calculation). IM can listen for these events and trigger routes automatically.
Configuration: config/application.properties
Enable event polling and map event types to route IDs:
integration.events.enabled=true
integration.events.scheduler-delay=60000
integration.events.delay=10000
integration.events.event-to-route-mapping.PADATALOAD_COMPLETED=direct:onPADataLoadCompleted
integration.events.event-to-route-mapping.CALCULATION_COMPLETED_CFS=direct:onCFSCalculated
Route: routes/event-handlers.xml
<routes xmlns="http://camel.apache.org/schema/spring">
<!-- Triggered when PA data load completes -->
<route id="onPADataLoadCompleted">
<from uri="direct:onPADataLoadCompleted"/>
<!-- event body is a Map with key "data" containing a list of target info -->
<setHeader headerName="targetName">
<simple>${body[data][0][targetName]}</simple>
</setHeader>
<choice>
<when>
<simple>${headers.targetName} == 'DMDS.Product'</simple>
<!-- Flush the data feed after the data source is loaded -->
<to uri="pfx-api:flush?dataFeedName=DMF.Product&dataSourceName=DMDS.Product"/>
</when>
<when>
<simple>${headers.targetName} == 'DMDS.Customer'</simple>
<to uri="pfx-api:flush?dataFeedName=DMF.Customer&dataSourceName=DMDS.Customer"/>
</when>
<otherwise>
<log message="Unhandled PA data load target: ${headers.targetName}"/>
</otherwise>
</choice>
</route>
<!-- Triggered when CFS calculation completes -->
<route id="onCFSCalculated">
<from uri="direct:onCFSCalculated"/>
<log message="CFS calculation completed: ${body}"/>
<!-- Add downstream actions here, e.g. export results -->
</route>
</routes>
How It Works
-
IM polls Pricefx for new events every
scheduler-delaymilliseconds -
When an event arrives matching a configured type, IM calls the mapped
direct:route -
The event payload (body) is a Map —
body[data][0][targetName]contains the affected object name -
The route processes the event synchronously
Common Event Types
|
Event Type |
When It Fires |
|---|---|
|
|
After |
|
|
After a CFS (Customer Fact Sheet) calculation finishes |
|
|
After a rebate version calculation finishes |
Common Pitfalls
-
Event polling requires
integration.events.enabled=true— it isfalseby default -
Route IDs in
event-to-route-mappingmust exactly match the<route id="...">in your XML -
The
direct:prefix is required — events call synchronous routes -
If the event handler route fails, the event is not retried automatically — add error handling