You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by polanki <va...@pimco.com> on 2016/05/02 22:44:09 UTC

How to stop particular routes in camel context based on elapsed time?

if I have sample script like below. 

In this script different routes in context starts in different times. In the
same way I want to stop particular route after specified time rather than
stopping entire context. How can I do this?
Like InitialDelay is there termination time for route?

      final CamelContext camelContext = new DefaultCamelContext();
        try {
          camelContext.addRoutes(
            new RouteBuilder() {
              @Override
                public void configure() throws Exception {

                 
from("ftp://prodpmst11.com/TEST2/?username=AAAA&password=BBBB"
                     +
"&initialDelay=10s&delay=5s&backoffMultiplier=6&backoffIdleThreshold=5"
                     + "&delete=true&greedy=true").
                     to("file:C:\\personal\\input\\fold");
                  
                 
from("ftp://prodpmst22.com/TEST3/?username=XXXX&password=YYYYY"
                          +
"&initialDelay=1s&delay=5s&backoffMultiplier=6&backoffIdleThreshold=5"
                          + "&delete=true&greedy=true").
                          to("file:C:\\personal\\input\\fold1");
                }
            });
            camelContext.start();
            Thread.sleep(100000);
            camelContext.stop();



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-particular-routes-in-camel-context-based-on-elapsed-time-tp5782090.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to stop particular routes in camel context based on elapsed time?

Posted by Claus Ibsen <cl...@gmail.com>.
Some details here
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

Also there is API on CamelContxt to stop/start/suspend/resume routes
http://camel.apache.org/lifecycle

And there is the control bus eip
http://camel.apache.org/controlbus.html

On Mon, May 2, 2016 at 10:44 PM, polanki <va...@pimco.com> wrote:
> if I have sample script like below.
>
> In this script different routes in context starts in different times. In the
> same way I want to stop particular route after specified time rather than
> stopping entire context. How can I do this?
> Like InitialDelay is there termination time for route?
>
>       final CamelContext camelContext = new DefaultCamelContext();
>         try {
>           camelContext.addRoutes(
>             new RouteBuilder() {
>               @Override
>                 public void configure() throws Exception {
>
>
> from("ftp://prodpmst11.com/TEST2/?username=AAAA&password=BBBB"
>                      +
> "&initialDelay=10s&delay=5s&backoffMultiplier=6&backoffIdleThreshold=5"
>                      + "&delete=true&greedy=true").
>                      to("file:C:\\personal\\input\\fold");
>
>
> from("ftp://prodpmst22.com/TEST3/?username=XXXX&password=YYYYY"
>                           +
> "&initialDelay=1s&delay=5s&backoffMultiplier=6&backoffIdleThreshold=5"
>                           + "&delete=true&greedy=true").
>                           to("file:C:\\personal\\input\\fold1");
>                 }
>             });
>             camelContext.start();
>             Thread.sleep(100000);
>             camelContext.stop();
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-stop-particular-routes-in-camel-context-based-on-elapsed-time-tp5782090.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2