Hi,

I have route (pseudo cod):

from(direct:start)
.to("direct:a")
.process(Prepare response)

from(direct:a)
.doTry()
.process(...)
.to(callWebService)
.process(onWebServiceSuccess)
.doCatch()
.process(whenException)

now I try use Hystrix, so I made subflow (I wan't in hystrix only web
service, without .process(onWebServiceSuccess) execution) for line:
".to(callWebService)":

from(direct:a)
.doTry()
.process(...)
.to(direct:subflow)
.process(onWebServiceSuccess)
.doCatch()
.process(whenException)

from(direct:subflow)
.hystrix()
.to(callWebService)
.onFallback()
do what?

What can I do in onFallback() method?, because after onFallback(), subflow
(direct:subflow) ending, and next step is .process(onWebServiceSuccess) in
from(direct:a) flow, when there was an error and
.process(onWebServiceSuccess) can't execute.

I was trying throw exception in onFallback(), but then doCatch() in
(direct:a) don't catch me this exception:
from(direct:subflow)
.errorHandler(noErrorHandler()) //it's required here?
.hystrix()
.to(callWebService)
.onFallback()
.throwException(new RuntimeException)

Good solution will be execute code from .doCatch in .onFallback(), but then
I need stop parent flow: (direct:a), to don't execute
.process(onWebServiceSuccess), and continue execution in flow
(direct:start).

It's possible?

Also I was trying with .onException in parent flow: direct:a. Then, it catch
exception, thrown in (direct:subflow) onFallback(), don't execute
.process(onWebServiceSuccess), but after that, execution is stop,
.process(Prepare response) from (direct:start) not execute:

from(direct:a)
.onException(Exception.class)
.process(whenException)
.end()
.process(...)
.to(direct:subflow)
.process(onWebServiceSuccess)

from(direct:subflow)
.errorHandler(noErrorHandler())
.hystrix()
.to(callWebService)
.onFallback()
.throwException(new RuntimeException)

How can I resolve this problem?
Why exception thrown in onFallback not catched in parent try catch?

thanks, for help.
Daniel



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Hystrix-rethrow-exception-in-fallback-tp5806369.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to