Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

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

integration.route-error-handling.enabled

true

Sets whether the defaultErrorHandler bean should be created or not.

integration.route-error-handling.maximumRedeliveries

10

Sets the maximum number of times a message exchange will be redelivered. Setting a negative value will retry forever.

integration.route-error-handling.redeliveryDelay

2000

Sets the initial redelivery delay in milliseconds.

integration.route-error-handling.maximumRedeliveryDelay


300000

Sets the maximum redelivery delay in milliseconds. Use -1 if you wish to have no maximum.

integration.route-error-handling.useExponentialBackOff

true

Enables/disables exponential backoff using the integration.route-error-handling.back-off-multiplier to increase the time between retries.

integration.route-error-handling.backOffMultiplier

2.0

Sets the multiplier used to increase the delay between redeliveries if exponential backoff is enabled.

integration.route-error-handling.logHandled

true

Sets whether errors should be logged even if they are handled.

integration.route-error-handling.retryAttemptedLogLevel


INFO

Sets the logging level to use for log messages when retries are attempted. Possible values are: TRACE, DEBUG, INFO, WARN, ERROR, OFF.

integration.route-error-handling.logRetryAttempted

true

Sets whether retry attempts should be logged or not.

integration.route-error-handling.logStackTrace

true

Sets whether stack traces should be logged or not.

integration.route-error-handling.retry.exceptions

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:

  • false (default) – Configured exceptions are appended to the default exceptions list.

  • true – Configured exceptions override default exceptions.

This property is used with the DefaultRetryWhilePredicate component.

integration.route-error-handling.retry.httpStatus

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:

  • false (default) –Configured HTTP response status codes are appended to the default status codes list.

  • true – Configured HTTP response status codes override the default status codes list.

This property is used with the DefaultRetryWhilePredicate component.

integration.route-error-handling.retry.overrideDefaults

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.

integration.route-error-handling.enableSendingMail

up to 1.1.17

false

Sets whether an email should be sent in case of an error.

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

1.1.18

integration.route-error-handling.email.smtpHost

localhost

Sets the SMTP hostname.

integration.route-error-handling.email.smtPort

25

Sets the SMTP port.

integration.route-error-handling.email.smtpAuth

false

Sets whether authentication for SMTP should be used.

integration.route-error-handling.email.smtpAuthUsername

Sets the username for SMTP authentication.

integration.route-error-handling.email.smtpAuthPassword

Sets the password for SMTP authentication.

integration.route-error-handling.email.smtp-ssl

false

Sets the info about usage of SSL in communication with SMPT host.

integration.route-error-handling.email.mailFrom


integration@pricefx.eu

Sets the email sender.

Current convention in IM team: integration_<pfx.partition>@pricefx.eu

integration.route-error-handling.email.mailTo


integration@pricefx.eu

Sets the email recipients. Multiple addresses are separated with a semicolon ';'.

Current convention in IM team:

  • For PROD partition: <IE email>;integration@pricefx.eu

  • For QA, DEV partition: <IE email>

integration.route-error-handling.email.mailSubject


Camel processing error!

Sets the subject of the email.

integration.route-error-handling.email.emailContentTemplate

1.1.18

email/default-email-template.vm

(internal template)

Sets a template for the error email body.
e.g. integration.route-error-handling.email.email-content-template=file:///Users/johndoe/workspace/pricefx/pricefx-integration-commons/config/email-template/my-template.vm

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

1.9.0

false

Sets whether the aggregation of error messages is enabled or not.

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

1.9.0

600

Sets the period (in seconds) in which another check of errors to aggregate will be performed.

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

1.9.0

0

Defines the size of the error message which will be used as an input key of the aggregation.
If default 0 is set, the first line of the error is used for aggregation. Otherwise the defined size of an error (including detailed error message) is used for the aggregation.

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

1.9.0

1.0

Specifies similarity of the errors. The range of this value is from 0.0 to 1.0:

  • If the default value 1.0 is set, the aggregation requires a precise match of error messages.

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

1.9.0

${integration.name} Summary integration processing report!

Sets the subject of the summary email.

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

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.

integration.route-error-handling.email.smtpSslProtocols

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 javax.net.ssl.SSLSocket.setEnabledProtocols method.

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

  1. 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}

  2. 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

  • No labels