You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by aidatechinc <HF...@AIDATECH.COM> on 2015/01/18 05:36:37 UTC

Removing a route after it is completed

I am trying to remove a route using   camelContext.removeRoute(routeId) but I
only want to do it one the route is complete.  I have the below snippet of
code, I attempted to use onCompletion, but no luck.


val camel = CamelExtension(system)
 camel.context.addRoutes(new CustomRouteBuilder(system, producer))

 class CustomRouteBuilder(system: ActorSystem, producerActor: ActorRef)
extends RouteBuilder {

        def configure {
          from(route.source.uri).to(route.target.uri)
            .routeId(route.source.id)
        }
      }



--
View this message in context: http://camel.465427.n5.nabble.com/Removing-a-route-after-it-is-completed-tp5761836.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Removing a route after it is completed

Posted by aidatechinc <HF...@AIDATECH.COM>.
Thank you. Since I am using akka, I need to kill that actor as well to stop
it totally.



--
View this message in context: http://camel.465427.n5.nabble.com/Removing-a-route-after-it-is-completed-tp5761836p5761929.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Removing a route after it is completed

Posted by Claus Ibsen <cl...@gmail.com>.
You can stop and then remove the route, then Camel does a graceful
shutdown of the route to complete all its inflight messages first.



On Sun, Jan 18, 2015 at 5:36 AM, aidatechinc <HF...@aidatech.com> wrote:
> I am trying to remove a route using   camelContext.removeRoute(routeId) but I
> only want to do it one the route is complete.  I have the below snippet of
> code, I attempted to use onCompletion, but no luck.
>
>
> val camel = CamelExtension(system)
>  camel.context.addRoutes(new CustomRouteBuilder(system, producer))
>
>  class CustomRouteBuilder(system: ActorSystem, producerActor: ActorRef)
> extends RouteBuilder {
>
>         def configure {
>           from(route.source.uri).to(route.target.uri)
>             .routeId(route.source.id)
>         }
>       }
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Removing-a-route-after-it-is-completed-tp5761836.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/