You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Frank <fd...@gmail.com> on 2012/03/19 23:45:35 UTC
Restarting the Camel route
My route looks like this:
intercept().bean(DoAsIWish.class)
from("direct:start")
.bean(BeanA.class)
.bean(BeanB.class)
.bean(BeanC.class)
.bean(BeanD.class)
.to("log:print");
How can I stop the route in the middle and restart the route from the
beginning?
Suppose in the above example, I want to stop my route at BeanC and want to
restart the whole route.
The below line stops the whole exchange and not very useful in my case.
exchangeIn.setProperty(exchangeIn.ROUTE_STOP, Boolean.TRUE);
Anyone please help me.
Thanks,
Frank
--
View this message in context: http://camel.465427.n5.nabble.com/Restarting-the-Camel-route-tp5578588p5578588.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Restarting the Camel route
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
See this FAQ about stopping a route from a route
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
Its improved over the book example as there is some corner cases, that
the FAQ approach handles better.
On Tue, Mar 20, 2012 at 9:36 PM, Frank <fd...@gmail.com> wrote:
> Hi,
>
> intercept().bean(DoAsIWish.class);
> from("direct:start").routeId("myRoute)
> .bean(BeanA.class)
> .bean(BeanB.class)
> .bean(BeanC.class)
> .bean(BeanD.class)
> .to("seda:out")
> .to("log:print");
> producerTemplate.sendBody("direct:start", outputString);
> consumerTemplate.receiveBody("seda:out").toString();
>
> When I am trying to stop my route using example of camel context stop method
> in Chapter 13, I am getting the following exception.
>
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[Message: Somemessage]
>
> Can you suggest me how to remove the CamelExecutionException.
>
> Thanks,
> Frank
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Restarting-the-Camel-route-tp5578588p5581162.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Restarting the Camel route
Posted by Frank <fd...@gmail.com>.
Hi,
intercept().bean(DoAsIWish.class);
from("direct:start").routeId("myRoute)
.bean(BeanA.class)
.bean(BeanB.class)
.bean(BeanC.class)
.bean(BeanD.class)
.to("seda:out")
.to("log:print");
producerTemplate.sendBody("direct:start", outputString);
consumerTemplate.receiveBody("seda:out").toString();
When I am trying to stop my route using example of camel context stop method
in Chapter 13, I am getting the following exception.
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: Somemessage]
Can you suggest me how to remove the CamelExecutionException.
Thanks,
Frank
--
View this message in context: http://camel.465427.n5.nabble.com/Restarting-the-Camel-route-tp5578588p5581162.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Restarting the Camel route
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Mar 20, 2012 at 5:28 AM, Frank <fd...@gmail.com> wrote:
> Craig,
>
> Could you tell me how I have to get the route id? Do I need to define the
> route id? Please help me.
>
You can explicit set the route id, using .routeId("myRouteName")
from(xxxx).routeId("xxxx")
...
> Thanks,
> Frank
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Restarting-the-Camel-route-tp5578588p5579028.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Restarting the Camel route
Posted by Frank <fd...@gmail.com>.
Craig,
Could you tell me how I have to get the route id? Do I need to define the
route id? Please help me.
Thanks,
Frank
--
View this message in context: http://camel.465427.n5.nabble.com/Restarting-the-Camel-route-tp5578588p5579028.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Restarting the Camel route
Posted by Craig Taylor <ct...@ctalkobt.net>.
Not sure how the exchangeIn.ROUTE_STOP is working but the camel context has
a start/stopRoute(routeId / RouteDefinition) you can use.
On Mon, Mar 19, 2012 at 6:45 PM, Frank <fd...@gmail.com> wrote:
> My route looks like this:
>
> intercept().bean(DoAsIWish.class)
> from("direct:start")
> .bean(BeanA.class)
> .bean(BeanB.class)
> .bean(BeanC.class)
> .bean(BeanD.class)
> .to("log:print");
>
> How can I stop the route in the middle and restart the route from the
> beginning?
>
> Suppose in the above example, I want to stop my route at BeanC and want to
> restart the whole route.
>
> The below line stops the whole exchange and not very useful in my case.
> exchangeIn.setProperty(exchangeIn.ROUTE_STOP, Boolean.TRUE);
>
> Anyone please help me.
>
> Thanks,
> Frank
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Restarting-the-Camel-route-tp5578588p5578588.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
-------------------------------------------
Craig Taylor
ctalkobt@ctalkobt.net