You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Matteo Pavesi <pa...@gmail.com> on 2014/10/29 13:47:09 UTC

CircuitBreaker possible issue with async processor

Hi all, 

I'm very keen to integrate the circuit breaker EIP in an application, but I
noticed a misbehaviour when I use it with async processors, which is a
common case.

The problem is that the exception in the exchange seems to be populated
after the "hasFailed" method invocation.

To reproduce the error in the junit, I slightly changed the testing route
from:

from("direct:start").loadBalance()
                    .circuitBreaker(2, 1000L, MyCustomException.class)
                        .to("mock:result")

to

from("direct:start").loadBalance()
                    .circuitBreaker(2, 1000L, MyCustomException.class)
                        .threads(1).to("mock:result")

I raised an issue and attached a patch with a proposed fix:
https://issues.apache.org/jira/browse/CAMEL-7973

Matteo



--
View this message in context: http://camel.465427.n5.nabble.com/CircuitBreaker-possible-issue-with-async-processor-tp5758295.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CircuitBreaker possible issue with async processor

Posted by Matteo Pavesi <pa...@gmail.com>.
I modified the issue, adding another problem that I discovered and that I
believe my patch fixes.

The second problem addressed is that, after the opening of the circuit, the
RejectedExecutionException raised by the circuit breaker is set in the
Exchange, but it doesn't return. This cause the processor will receive the
Exchange even if the circuit is open. In this case also, if the
CircuitBreaker is instructed to react only to specific Exception, it will
close the circuit after the following request, because the raised exception
would be a RejectedExecutionException instead of the one specified in the
configuration.



--
View this message in context: http://camel.465427.n5.nabble.com/CircuitBreaker-possible-issue-with-async-processor-tp5758295p5758310.html
Sent from the Camel - Users mailing list archive at Nabble.com.