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
integration.route-error-handling.enableSendingMail=true integration.route-error-handling.email.emailContentTemplate=file:///Users/johndoe/workspace/pricefx/pricefx-integration-commons/config/email-template/my-template.vm
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
integration.route-error-handling.email.aggregation.
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.
Problem with PFX Integration Error : org.apache.http.NoHttpResponseException: fbu.pricefx.eu:443 failed to respond -- fbu.pricefx.eu:443 failed to respond Route ID : perEventTypeEventRouteInputEventRouteCALCULATION_COMPLETED_CFS EndPoint TO : null EndPoint FROM : scheduler://perEventTypeEventRouteCALCULATION_COMPLETED_CFS?delay=60000 Failure EndPoint : null Failure route ID : null Error stack trace: com.sun.jersey.api.client.ClientHandlerException: org.apache.http.NoHttpResponseException: fbu.pricefx.eu:443 failed to respond at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) at com.sun.jersey.api.client.Client.handle(Client.java:652) at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570) at io.swagger.client.ApiClient.getAPIResponse(ApiClient.java:562) at io.swagger.client.ApiClient.invokeAPI(ApiClient.java:592) at net.pricefx.integration.api.ConfigurableApiClient.invokeAPI(ConfigurableApiClient.java:100) at net.pricefx.integration.api.client.GeneralDatasourceApi.fetchByObjectType(GeneralDatasourceApi.java:528) at net.pricefx.integration.processor.FetchEventsProcessor.fetchEvents(FetchEventsProcessor.java:77) at net.pricefx.integration.processor.FetchEventsProcessor.process(FetchEventsProcessor.java:43) at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:76) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.component.scheduler.SchedulerConsumer.sendTimerExchange(SchedulerConsumer.java:54) at org.apache.camel.component.scheduler.SchedulerConsumer.poll(SchedulerConsumer.java:39) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.http.NoHttpResponseException: fbu.pricefx.eu:443 failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:171) ... 28 more