[
https://issues.apache.org/jira/browse/CAMEL-5139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246134#comment-13246134
]
Radoslaw Szymanek commented on CAMEL-5139:
------------------------------------------
A side note.
While debugging I noticed that the predicate in continued(Predicate) is
executed twice. I see no obvious reasons why it would happen (no redeliveries
allowed in my route, etc). The first execution happens right at the beginning
of the onException(...), then processor is executed to "fix" the exchange and
then the Predicate is called again with "fixed" exchange so true can be
returned.
The onException part within a route looks like this :
.onException(IllegalArgumentException.class)
.process(new NullRegistrationDateProcessor())
.continued(new Predicate() { ... }
.end()
Moreover, even if the predicate within continued always returns true (even the
first time called for the original exchange that caused exception) it does not
prevent the processor to be executed and second time the predicate within
continued again.
The second execution of continued is the deciding one, if rigged to return
false, while the first execution of the predicate is rigged to return true this
will not continue the exchange.
I do not create an issue out of this as this may be perfectly reasonable
behavior. However, it is suspicious enough to deserve a note in this issue.
> Continued(Predicate) does not work when invoked the second time in the Camel
> flow.
> ----------------------------------------------------------------------------------
>
> Key: CAMEL-5139
> URL: https://issues.apache.org/jira/browse/CAMEL-5139
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.9.1
> Reporter: Radoslaw Szymanek
> Priority: Minor
>
> When Camel flow contains error handling as continued(Predicate), it is not
> invoked when the error occurs for the second time (even in different
> onException). What is more the exception is not handled even by global
> onException and Camel flow is interrupted.
> It is similar issue to https://issues.apache.org/jira/browse/CAMEL-4057
> but not for continued(true) but continued(Predicate).
> The same fix also fixes this problem. Simply adding
> exchange.removeProperty(Exchange.FAILURE_HANDLED);
> just before returning true from the Predicate makes the second onException
> being called and the second time the exception is raised it can be continued
> again.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira