Overview
The fetch method creates a scheduled poll consumer that periodically fetches events from the Pricefx server, processes them, and acknowledges them back.
URI format:
pfx-event:fetch?connection=pricefx&eventTypes=PADATALOAD_COMPLETED[&options]
For the recommended properties-based setup (no route XML needed for the fetch itself), see the Events page.
Parameters
Core Parameters
|
Parameter |
Type |
Default |
Required |
Description |
|---|---|---|---|---|
|
|
String |
|
Yes |
Pricefx connection name |
|
|
String |
|
Yes |
Comma-separated event types to fetch (e.g. |
|
|
Integer |
|
No |
Maximum events fetched per poll |
|
|
String |
|
No |
JSON parser: |
Scheduler Parameters
Inherits all ScheduledPollEndpoint parameters:
|
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
Integer |
|
Milliseconds before the first poll |
|
|
Integer |
|
Milliseconds between polls |
|
|
boolean |
|
Fixed delay (true) vs. fixed rate (false) |
|
|
boolean |
|
Run again immediately if previous poll found messages |
|
|
boolean |
|
Send empty message when no events polled |
|
|
Integer |
|
Polls to skip after consecutive idles/errors |
|
|
Integer |
|
Error count before backoff kicks in |
|
|
Integer |
|
Idle count before backoff kicks in |
|
|
LoggingLevel |
|
Log level for poll start/complete messages |
|
|
boolean |
|
Bridge consumer exceptions to Camel error handler |
Processing Flow
When fetch polls:
-
Retry events are processed first — any events stored locally from previous failed attempts.
-
New events are fetched from Pricefx (EVT API), filtered to the configured event types, sorted by ID.
-
For each event:
-
An exchange is created with the parsed event map as the body.
-
Headers
event.typedIdandevent.nameare set. -
The downstream route processes the exchange.
-
On success: event is acknowledged (httpResponse=200) and optionally archived.
-
On failure: event is acknowledged as failed (httpResponse=0) and written to the error directory.
-
-
Events are acknowledged in batches of 100 via the Pricefx massedit API.
Examples
Single event type with custom polling interval
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="fetchPADataLoad">
<from uri="pfx-event:fetch
?connection=pricefx
&eventTypes=PADATALOAD_COMPLETED
&maxEvents=500
&delay=10000
&initialDelay=5000"/>
<to uri="direct:handlePADataLoad"/>
</route>
</routes>
Multiple event types with routing
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="fetchEvents">
<from uri="pfx-event:fetch
?connection=pricefx
&eventTypes=PADATALOAD_COMPLETED,CALCULATION_COMPLETED_CFS
&delay=15000"/>
<choice>
<when>
<simple>${body[eventType]} == 'PADATALOAD_COMPLETED'</simple>
<to uri="direct:handlePADataLoad"/>
</when>
<when>
<simple>${body[eventType]} == 'CALCULATION_COMPLETED_CFS'</simple>
<to uri="direct:handleCFSCalc"/>
</when>
</choice>
</route>
</routes>
Event Validation
The component validates that each event type is consumed by only one pfx-event:fetch route. Duplicate event types across routes cause an IllegalArgumentException at startup:
Event type PADATALOAD_COMPLETED is already used by another route with pfx-event component
Common Pitfalls
-
Duplicate event types: Each event type must be consumed by exactly one route.
-
High maxEvents with slow processing: Start with 100–500 and tune upward.
-
Stuck events: If processing fails silently, events may remain stuck. Enable
check-stuck-processing.enabled=true. -
Custom event prefix: In the properties mapping key use
CUSTOM.MY_EVENT, but the Pricefx event type itself isMY_EVENTwithout the prefix.