3 Replies Latest reply on Oct 6, 2010 12:16 AM by Claus Ibsen

    stopping a route within processor

    Shilpi Yadav Novice

      I was wondering what would be the best way to stop a route within a processor? My route is something like this:




      I'd like to be able to stop the route from going on depending on some logic defined within the MyProcessor bean.  What's the best way to do this rather than throwing an exception?

        • 1. Re: stopping a route within processor
          Willem Jiang Master

          You can do it from Camel 2.4.0. like this

             <route id="myRoute">
               <from uri="timer://PullTimer?fixedRate=true&amp;period=1000"></from>
               <process ref="MyProcessor"></process>
               ... <!-- more stuff here-->



                public void process(Exchange exchange) throws Exception {
                              // force stopping this route while we are routing an Exchange
                              // requires two steps:
                              // 1) unregister from the inflight registry (in Camel 2.5.0)
                              // 2) stop the route


            You can find more information about it in Camel in Action Chapter 13.

          • 2. Re: stopping a route within processor
            Shilpi Yadav Novice

            Looks like the suggested fix actually stopped the route from kicking off totally.  I'd like for it to just stop for that one instance.

            • 3. Re: stopping a route within processor
              Claus Ibsen Master

              There is a <stop/> in the DSL you can use.


              Or you can set a header on the current Exchange. Exchange.STOP (I think thats key key) with the value Boolean.TRUE.