pfx-event:fetch

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

connection

String


Yes

Pricefx connection name

eventTypes

String


Yes

Comma-separated event types to fetch (e.g. PADATALOAD_COMPLETED,CALCULATION_COMPLETED_CFS)

maxEvents

Integer

1000

No

Maximum events fetched per poll

jsonParser

String

gson

No

JSON parser: gson or jackson

Scheduler Parameters

Inherits all ScheduledPollEndpoint parameters:

Parameter

Type

Default

Description

initialDelay

Integer

1000

Milliseconds before the first poll

delay

Integer

500

Milliseconds between polls

useFixedDelay

boolean

true

Fixed delay (true) vs. fixed rate (false)

greedy

boolean

false

Run again immediately if previous poll found messages

sendEmptyMessageWhenIdle

boolean

false

Send empty message when no events polled

backoffMultiplier

Integer


Polls to skip after consecutive idles/errors

backoffErrorThreshold

Integer


Error count before backoff kicks in

backoffIdleThreshold

Integer


Idle count before backoff kicks in

runLoggingLevel

LoggingLevel

TRACE

Log level for poll start/complete messages

bridgeErrorHandler

boolean

false

Bridge consumer exceptions to Camel error handler


Processing Flow

When fetch polls:

  1. Retry events are processed first — any events stored locally from previous failed attempts.

  2. New events are fetched from Pricefx (EVT API), filtered to the configured event types, sorted by ID.

  3. For each event:

    • An exchange is created with the parsed event map as the body.

    • Headers event.typedId and event.name are 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.

  4. Events are acknowledged in batches of 100 via the Pricefx massedit API.


Examples

Single event type with custom polling interval

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="fetchPADataLoad">
        <from uri="pfx-event:fetch
            ?connection=pricefx
            &amp;eventTypes=PADATALOAD_COMPLETED
            &amp;maxEvents=500
            &amp;delay=10000
            &amp;initialDelay=5000"/>
        <to uri="direct:handlePADataLoad"/>
    </route>
</routes>

Multiple event types with routing

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="fetchEvents">
        <from uri="pfx-event:fetch
            ?connection=pricefx
            &amp;eventTypes=PADATALOAD_COMPLETED,CALCULATION_COMPLETED_CFS
            &amp;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 is MY_EVENT without the prefix.