Error Handling

Error Handling

Summary: Configuration of IM error handling -- retry policies, exponential backoff, error email notifications, and error message aggregation.


Configuration

Default Error Handler Properties

Property

Default

Description

integration.route-error-handling.enabled

true

Whether the defaultErrorHandler bean should be created

integration.route-error-handling.maximumRedeliveries

10

Maximum redelivery attempts. Negative value = retry forever

integration.route-error-handling.redeliveryDelay

2000

Initial redelivery delay in milliseconds

integration.route-error-handling.maximumRedeliveryDelay

300000

Maximum redelivery delay in ms

integration.route-error-handling.useExponentialBackOff

true

Enable exponential backoff

integration.route-error-handling.backOffMultiplier

2.0

Multiplier for delay between redeliveries

integration.route-error-handling.logHandled

true

Log errors even if handled

integration.route-error-handling.logRetryAttempted

true

Whether to log retry attempts

integration.route-error-handling.logStackTrace

true

Whether to log stack traces

Retryable Exceptions and HTTP Status Codes

Property

Default

Description

integration.route-error-handling.retry.exceptions

RecoverableException, ConnectTimeoutException, ConnectException

Exceptions to retry

integration.route-error-handling.retry.httpStatus

409, 503, 504

HTTP status codes to retry

integration.route-error-handling.retry.overrideDefaults

false

If true, replace defaults; if false, append

Email Notification Properties

Property

Default

Description

integration.route-error-handling.enable-sending-mail

false

Enable error email notifications

integration.route-error-handling.email.smtpHost

localhost

SMTP hostname

integration.route-error-handling.email.smtPort

25

SMTP port

integration.route-error-handling.email.mailFrom

integration@pricefx.eu

Email sender address

integration.route-error-handling.email.mailTo

integration@pricefx.eu

Email recipients (semicolon-separated)

integration.route-error-handling.email.emailContentTemplate

email/default-email-template.vm

Velocity template for error email body

Error Message Aggregation

Property

Default

Description

integration.route-error-handling.email.aggregation.enabled

false

Enable error message aggregation

integration.route-error-handling.email.aggregation.checkPeriodInSeconds

600

Check period (seconds)

integration.route-error-handling.email.aggregation.similarityErrors

1.0

Error similarity threshold (1.0 = exact match)


Understanding Retry Behavior

Which Errors Are Retried?

By default, IM retries these exception types:

  • RecoverableException -- transient Pricefx API errors

  • ConnectTimeoutException -- network timeout connecting to host

  • ConnectException -- connection refused

And these HTTP status codes:

  • 409 -- Conflict (concurrent load/flush in progress)

  • 503 -- Service Unavailable (server temporarily down)

  • 504 -- Gateway Timeout

All other errors fail immediately without retry.

Retry Timeline Example

With default settings (10 retries, 2s initial delay, 2.0 multiplier, 300s max):

Attempt

Delay

Cumulative

1

2s

2s

2

4s

6s

3

8s

14s

4

16s

30s

5

32s

62s

6

64s

~2 min

7

128s

~4 min

8

256s

~8 min

9

300s (max)

~13 min

10

300s (max)

~18 min

Retry vs. Fail Fast

Scenario

Recommendation

ConnectTimeoutException

Retry -- transient network issue

HTTP 409 Conflict

Retry -- another operation in progress

HTTP 503 Service Unavailable

Retry -- server restarting

HTTP 400 Bad Request

Do not retry -- fix the request

HTTP 401 Unauthorized

Do not retry -- fix credentials

IllegalStateException

Do not retry -- fix configuration

CSV parse error

Do not retry -- fix the source data


Route-Level Error Handling

onCompletion for Cleanup

XML
<route id="import-with-cleanup">
    <from uri="file:..."/>
    <to uri="pfx-api:loaddata?objectType=P&amp;mapper=myMapper"/>

    <onCompletion onCompleteOnly="true">
        <log message="Import succeeded"/>
    </onCompletion>

    <onCompletion onFailureOnly="true">
        <log message="Import failed: ${exception.message}" loggingLevel="ERROR"/>
    </onCompletion>
</route>

doTry / doCatch for Specific Error Handling

XML
<route id="import-with-catch">
    <from uri="file:..."/>
    <doTry>
        <to uri="pfx-api:loaddata?objectType=P&amp;mapper=myMapper"/>
        <doCatch>
            <exception>java.net.ConnectException</exception>
            <log message="Connection failed, will retry later" loggingLevel="WARN"/>
        </doCatch>
        <doCatch>
            <exception>java.lang.IllegalStateException</exception>
            <log message="Configuration error: ${exception.message}" loggingLevel="ERROR"/>
        </doCatch>
    </doTry>
</route>

Convention for Email Configuration

  • PROD partitions: mailTo=<IE email>;integration@pricefx.eu

  • QA/DEV partitions: mailTo=<IE email>

  • mailFrom convention: integration_<pfx.partition>@pricefx.eu


See Also

  • Troubleshooting -- common runtime errors and solutions

  • Debugging -- debug logging and exchange inspection

  • Properties -- all integration.route-error-handling.* properties