Error Handling
Configuration
Set up Default Error Handler
To change the behavior of the default error handler, put the following properties into application.properties.Â
Property | Since | Default Value | Description |
---|---|---|---|
|  | true | Sets whether the defaultErrorHandler bean should be created or not. |
| Â | 10 | Sets the maximum number of times a message exchange will be redelivered. Setting a negative value will retry forever. |
| Â | 2000 | Sets the initial redelivery delay in milliseconds. |
| 300000 | Sets the maximum redelivery delay in milliseconds. Use -1 if you wish to have no maximum. | |
|  | true | Enables/disables exponential backoff using the integration.route-error-handling.back-off-multiplier to increase the time between retries. |
| Â | 2.0 | Sets the multiplier used to increase the delay between redeliveries if exponential backoff is enabled. |
| Â | true | Sets whether errors should be logged even if they are handled. |
| INFO | Sets the logging level to use for log messages when retries are attempted. Possible values are:Â TRACE, DEBUG, INFO, WARN, ERROR, OFF. | |
| Â | true | Sets whether retry attempts should be logged or not. |
| Â | true | Sets whether stack traces should be logged or not. |
| 1.1.17 | net.pricefx.integration.api.RecoverableException, org.apache.http.conn.ConnectTimeoutException, java.net.ConnectException | A comma-separated list of fully qualified class names of exceptions that should be redelivered. If option integration.route-error-handling.retry.override-defaults is:
This property is used with the DefaultRetryWhilePredicate component. |
| 1.1.17 | 409, 503, 504 | A comma-separated list of HTTP response status codes that should be redelivered. If option integration.route-error-handling.retry.override-defaults is:
This property is used with the DefaultRetryWhilePredicate component. |
| 1.1.17 | false | Sets whether default values of exceptions and HTTP status codes should be overridden. This property is used with the DefaultRetryWhilePredicate component. |
| up to 1.1.17 | false | Sets whether an email should be sent in case of an error. |
| 1.1.18 | ||
| Â | localhost | Sets the SMTP hostname. |
| Â | 25 | Sets the SMTP port. |
| Â | false | Sets whether authentication for SMTP should be used. |
| Â | Â | Sets the username for SMTP authentication. |
| Â | Â | Sets the password for SMTPÂ authentication. |
| Â | false | Sets the info about usage of SSL in communication with SMPT host. |
| Sets the email sender. Current convention in IM team:Â integration_<pfx.partition>@pricefx.eu | ||
| Sets the email recipients. Multiple addresses are separated with a semicolon ';'. Current convention in IM team:
| ||
| Camel processing error! | Sets the subject of the email. | |
| 1.1.18 | email/default-email-template.vm (internal template) | Sets a template for the error email body. |
| 1.9.0 | false | Sets whether the aggregation of error messages is enabled or not. |
| 1.9.0 | 600 | Sets the period (in seconds) in which another check of errors to aggregate will be performed. |
| 1.9.0 | 0 | Defines the size of the error message which will be used as an input key of the aggregation. |
| 1.9.0 | 1.0 | Specifies similarity of the errors. The range of this value is from 0.0 to 1.0:
|
| 1.9.0 | ${integration.name} Summary integration processing report! | Sets the subject of the summary email. |
| 1.9.0 | 10 | Sets the count of different types of errors that will be stored in a memory. If this value is exceeded, the oldest type of an aggregate error is removed from the memory and the summary email is sent for this error. |
| 4.10.10, 5.4.0 | Â | Specifies the SSL protocols that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptable to the |
Configuration of the error handler is logged during IM startup. Example:
14:48:38.399 | INFO | main | | | n.p.i.a.core.CoreAutoConfiguration | Error Handling AutoConfiguration is [ENABLED] with configuration [RouteErrorHandlingProperties(enabled=true, maximumRedeliveryDelay=300000, maximumRedeliveries=10, retryAttemptedLogLevel=INFO, redeliveryDelay=2000, backOffMultiplier=2.0, useExponentialBackOff=true, logRetryAttempted=true, logHandled=true, logStackTrace=true, enableSendingMail=false, retry=RouteErrorHandlingProperties.Retry(overrideDefaults=false, exceptions=[class java.net.ConnectException, class net.pricefx.integration.api.RecoverableException, class org.apache.http.conn.ConnectTimeoutException], httpStatus=[503, 504]))]
14:48:38.404 | INFO | main | | | n.p.i.a.core.CoreAutoConfiguration | Email Error Listener AutoConfiguration is [DISABLED] with configuration [RouteErrorHandlingProperties.EmailProperties(smtpHost=localhost, smtpPort=25, smtpAuth=false, smtpAuthUsername=null, smtpAuthPassword=null, smtpSsl=false, mailFrom=integration@pricefx.eu, mailTo=[martin@pricefx.eu, kocour@pricefx.eu], mailSubject=Camel processing error!, emailContentTemplate=email/default-email-template.vm)]
Apply Default Error Handler to Camel Context
Use the defaultErrorHandler bean reference as the Camel context attribute.
<camelContext xmlns="http://camel.apache.org/schema/spring" useMDCLogging="true" errorHandlerRef="defaultErrorHandler">
How to Set Custom Error Email Template
Create a Velocity template for an error email. E.g.:
file:///Users/johndoe/workspace/pricefx/pricefx-integration-commons/config/email-template/my-template.vm
Hello error template of exchange ${exchange.exchangeId} with body ${body} and headers ${headers} caused by ${exchange.properties.CamelExceptionCaught}
Â
Configure the error handler to use the custom template:
application.properties
Error Messages Aggregation
There is a possibility to turn on the aggregation of error messages in order to prevent receiving a lot of the same error messages.
By default the aggregation is disabled. It is sufficient to set parameter integration.route-error-handling.email.aggregation.enabled=true to turn on the aggregation without setting other parameters if not needed.
All parameters of this aggregation including turning on the aggregation are mentioned in the table above with prefix:Â
application.properties
Failed Integration Jobs
All integration jobs (including scheduled integration jobs) are monitored and if they fail, Pricefx is notified by an email. The email can also be sent to the customer if required. The monitoring is per project where each IM has set up its own monitoring.
Â
IntegrationManager version 5.8.0