Name
On Exception — Route to be executed when an exception is thrown
Usage
The on exception pattern defines a set of steps that are executed when an exception is thrown. It can either be scoped local to a specific route or globally for all routes defined in the context.
![]() | Important |
---|---|
Locally scoped on exception patterns take precedent over globally scoped ones. Therefore in a locally scoped on exception pattern exists, the globally scoped pattern will not be executed. |
When specifying a locally scoped on exception pattern, the pattern directly follows the from endpoint in the route.
When specifying a globally scoped on exception pattern, the pattern starts a new route.
Properties
Table 4.9 describes the properties you can specify using the properties editor.
Table 4.9. On Exception Properties
Name | Description |
---|---|
Continued | Specifies an expression that determines if the exception is ignored and the
original route continues processing after the onException route
completes.[a] |
language | Specifies the expression language used to process the expression. |
Retry While | Specifies an expression that determines if the message causing the exception
should be redelivered. The message is redelivered until the expression evaluates to
false .[a] |
language | Specifies the expression language used to process the expression. |
Handled | Specifies an expression that determines if the exception is marked as handled.[a] |
language | Specifies the expression language used to process the expression. |
Exceptions | Specifies the list of exceptions the node handles. The | button adds an entry typed in the field. The button removes the selected entry from the list.
Redelivery Policy Ref | Specifies a reference to bean defining the redelivery policy. |
On Redelivery Ref | Specifies a reference to a custom processor for processing the message before it is redelivered. |
Inherit Error Handler | Specifies if the node should use the error handler configured for the route. |
Use Original Message Policy | Specifies that message that began the route is placed in the dead letter queue instead of the message that caused the exception. |
Id | Specifies a unique identifier for the endpoint. The Id can be used to refer to the endpoint in the Apache Camel configuration file. |
Description | Specifies a text description of the bean. The description is included in the generated XML file. |
[a] The expression is treated as
returning a boolean. If the expression evaluates to any non-boolean value other
than |
Redelivery Policy
Table 4.10 describes the properties for configuring the redelivery policy.
Table 4.10. Redelivery Properties
Name | Description |
---|---|
Async Delayed Redelivery | |
Back Off Multiplier |
Specifies the multiplier used to determine the redelivery delay if exponential
back-off is enabled. If d, m*d, m*m*d, m*m*m*d, ... |
Collision Avoidance Factor | Specifies a factor that is used to randomly tweak the redelivery delay if
collision avoidance is enabled. The collision avoidance policy tweaks the next
delay by a random amount, up to plus/minus p % of its current
value. |
Delay Pattern | |
Disable Redelivery | Specifies if the redelivery feature is disabled. Redelivery is enabled if Maximum Redeliveries is set to a positive number. |
Log Continued | |
Log Exhausted | |
Log Handled | |
Log Retry Attempted | |
Log Retry Stack Trace | |
Log Stack Trace | Specifies if the JVM stack trace is included in the error logs. |
Maximum Redeliveries | Specifies the maximum number of delivery attempts |
Maximum Redelivery Delay | Specifies, in milliseconds, the maximum redelivery delay when using an exponential back-off strategy. |
Redelivery Delay | Specifies the delay (in milliseconds) between redelivery attempts. |
Retries Exhausted Log Level | Specifies the logging level at which to log delivery failure. |
Retry Attempted Log Level | Specifies the logging level at which to redelivery attempts. |
Use Collision Avoidance | Enables collision avoidance, which adds some randomization to the back-off timings to reduce contention probability. |
Use Exponential Back Off | Enables exponential backoff. |
Related topics
Expression and Predicates Languages |
Adding beans and configuration in Using Fuse IDE |
Configuring the Fuse IDE route editor in Using Fuse IDE |