You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by LiQiang Ye <li...@gmail.com> on 2017/10/10 21:51:28 UTC
onCompletion doesn't get executed when onException handler is triggerred
Hi camel friends
I have routes designed as below. I wonder how I can make onCompletion()
block to execute route "c" even though route "a" or route "b" has exception
occurs. Currently when a processing route "a" or "b" encounters exception
and retries, the route will stop routing further and onCompletion block
never gets executed.
from("timer:reload-config?delay=" + reloadInterval +
"&fixedRate=true&period=" + reloadInterval)
.multicast().parallelProcessing()
.to("direct:a", "direct:b")
.end()
.onCompletion()
.log("parallel processing is done").setBody(constant(null)).to("direct:c")
------
from("direct:a")
.onException(Exception.class)
.maximumRedeliveries(3)
.redeliveryDelay(1000)
.backOffMultiplier(2)
.retryAttemptedLogLevel(LoggingLevel.WARN)
.handled(true)
.end()
.to("bean:aBean?method=setData")
Thanks
Re: onCompletion doesn't get executed when onException handler is triggerred
Posted by Mary Cochran <mc...@redhat.com>.
Have you tried externalizing the onCompletion(), such as putting this as a
separate statement above your route and below the onException()
onCompletion()
.log("parallel processing is done")
.setBody(constant(null)).to("direct:c");
Mary
Mary Cochran
Red Hat Consulting
mcochran@redhat.com
(419) 543-0531
On Wed, Oct 11, 2017 at 3:27 PM, LiQiang Ye <li...@gmail.com> wrote:
> Claus, I found that the route that main route that contains multicast will
> stop routing after "direct:a" hits exception handler. So I want to know how
> I can make the route continue routing even if "direct:a" hits exception and
> does its retries and stops.
>
> from("timer:reload-config?delay=" + reloadInterval +
> "&fixedRate=true&period=" + reloadInterval)
> .multicast().parallelProcessing()
> .to("direct:a", "direct:b")
> .end()
> .log("route is done") // Note: it will never hit the log if "direct:a"
> hits the exception handler.
>
>
>
>
> On Tue, Oct 10, 2017 at 2:51 PM, LiQiang Ye <li...@gmail.com>
> wrote:
>
> > Hi camel friends
> >
> > I have routes designed as below. I wonder how I can make onCompletion()
> > block to execute route "c" even though route "a" or route "b" has
> exception
> > occurs. Currently when a processing route "a" or "b" encounters exception
> > and retries, the route will stop routing further and onCompletion block
> > never gets executed.
> >
> >
> > from("timer:reload-config?delay=" + reloadInterval +
> > "&fixedRate=true&period=" + reloadInterval)
> > .multicast().parallelProcessing()
> > .to("direct:a", "direct:b")
> > .end()
> > .onCompletion()
> > .log("parallel processing is done").setBody(constant(null))
> .to("direct:c")
> >
> > ------
> >
> > from("direct:a")
> > .onException(Exception.class)
> > .maximumRedeliveries(3)
> > .redeliveryDelay(1000)
> > .backOffMultiplier(2)
> > .retryAttemptedLogLevel(LoggingLevel.WARN)
> > .handled(true)
> > .end()
> > .to("bean:aBean?method=setData")
> >
> > Thanks
> >
>
Re: onCompletion doesn't get executed when onException handler is triggerred
Posted by LiQiang Ye <li...@gmail.com>.
Claus, I found that the route that main route that contains multicast will
stop routing after "direct:a" hits exception handler. So I want to know how
I can make the route continue routing even if "direct:a" hits exception and
does its retries and stops.
from("timer:reload-config?delay=" + reloadInterval +
"&fixedRate=true&period=" + reloadInterval)
.multicast().parallelProcessing()
.to("direct:a", "direct:b")
.end()
.log("route is done") // Note: it will never hit the log if "direct:a"
hits the exception handler.
On Tue, Oct 10, 2017 at 2:51 PM, LiQiang Ye <li...@gmail.com> wrote:
> Hi camel friends
>
> I have routes designed as below. I wonder how I can make onCompletion()
> block to execute route "c" even though route "a" or route "b" has exception
> occurs. Currently when a processing route "a" or "b" encounters exception
> and retries, the route will stop routing further and onCompletion block
> never gets executed.
>
>
> from("timer:reload-config?delay=" + reloadInterval +
> "&fixedRate=true&period=" + reloadInterval)
> .multicast().parallelProcessing()
> .to("direct:a", "direct:b")
> .end()
> .onCompletion()
> .log("parallel processing is done").setBody(constant(null)).to("direct:c")
>
> ------
>
> from("direct:a")
> .onException(Exception.class)
> .maximumRedeliveries(3)
> .redeliveryDelay(1000)
> .backOffMultiplier(2)
> .retryAttemptedLogLevel(LoggingLevel.WARN)
> .handled(true)
> .end()
> .to("bean:aBean?method=setData")
>
> Thanks
>