You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by hekonsek <he...@gmail.com> on 2012/08/22 12:43:35 UTC

Re: Stopped Routes

Hi Ritu,

> how to will I configure XML so that route will only run once

Access CamelContext in Processor and close the route via
CamelContext#stopRoute().

from("direct:stopRoute").
  process(new Processor() {
    @Override
    public void process(Exchange exchange) throws Exception {
      String routeId = exchange.getIn().getBody(String.class);
      exchange.getContext().stopRoute(routeId);
    }
  });

Best regards.



--
View this message in context: http://camel.465427.n5.nabble.com/Stopped-Routes-tp474159p5717843.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Stopped Routes

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


On Wed, Aug 22, 2012 at 12:43 PM, hekonsek <he...@gmail.com> wrote:
> Hi Ritu,
>
>> how to will I configure XML so that route will only run once
>
> Access CamelContext in Processor and close the route via
> CamelContext#stopRoute().
>
> from("direct:stopRoute").
>   process(new Processor() {
>     @Override
>     public void process(Exchange exchange) throws Exception {
>       String routeId = exchange.getIn().getBody(String.class);
>       exchange.getContext().stopRoute(routeId);
>     }
>   });
>
> Best regards.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Stopped-Routes-tp474159p5717843.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen