...
This is best illustrated with an exception:
Code Block | ||||
---|---|---|---|---|
| ||||
onException(IOException.class).maximumRedeliveries(3); onException(OrderFailedException.class).maximumRedeliveries(2); |
...
Then Camel will try testing the exception in this order: FileNotFoundException, IOException, OrderFailedException and RuntimeCamelException.
As we have defined a onException(FileNotFoundExceptionIOException.class) Camel will select this as it's an exact the closest match.
If we add a third onException clause with the FileNotFoundException
Code Block | ||||
---|---|---|---|---|
| ||||
onException(IOException.class).maximumRedeliveries(3); onException(OrderFailedException.class).maximumRedeliveries(2); onException(FileNotFoundException.class).handled(true).to("log:nofile"); |
Then with the previous example Camel will now use the last onException(FileNotFoundException.class)
as its an exact match. Since this is an exact match it will overrule override the general IOException that was used before to handle the same exception thrown.
...