You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rajesh_h <ra...@hotmail.com> on 2013/03/09 02:23:40 UTC

CamelContext resume does not reactivate the route

Hello experts,

I have a route consuming from file endpoint and then other routes chained
downstream using direct:.

When I get a particular kind of exception, I want to be able to suspend the
CamelContext (camelContext.suspend). And then be able to resume the Context
from JMX. 

Now, what happens is that as soon as I issue "suspend context" from the
code, it goes through the defaultShutDownStrategy and logs these messages
for 300 seconds (expected).

*INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.523 Waiting
as there are still 5 inflight and pending exchanges to complete, timeout in
43 seconds.*

Not sure why the 5 inflight exchanges are not getting flushed out, but
eventually, times out and suspends the route. 

WARN.org.apache.camel.impl.DefaultShutdownStrategy:
*org.apache.camel.impl.DefaultShutdownStrategy.doShutdown.191 Timeout
occurred. Now forcing the routes to be shutdown now.
WARN.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.531
Interrupted while waiting during graceful shutdown, will force shutdown
now.*
INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
*route-psp1* suspend complete, was consuming from:*
Endpoint[file:///h/apps/proj/input?maxMessagesPerPoll=1&noop=false&readLock=changed*]
INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
route-psp2 suspend complete, was consuming from: Endpoint[direct://csv]
INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy.doShutdown.213 Graceful
shutdown of 6 routes completed in 300 seconds
INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
route-psp3 suspend complete, was consuming from:
Endpoint[direct://thousands]
INFO.org.apache.camel.spring.SpringCamelContext:
org.apache.camel.impl.DefaultCamelContext.doSuspend.1353 Apache Camel 2.10.3
(CamelContext: rdlCamelContext) is suspended in 5 minutes
INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
route-psp4 suspend complete, was consuming from: Endpoint[direct://update]
INFO.com.paypal.demandgen.rdl.RdlContextController:
com.paypal.demandgen.rdl.RdlContextController.suspend.33 Context suspended
INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
route-psp5 suspend complete, was consuming from:
Endpoint[direct://stopRoute]
INFO.org.apache.camel.impl.DefaultShutdownStrategy:
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
route-psp6 suspend complete, was consuming from:
Endpoint[direct://suspendContext]


Even after I resume the context using JMX, my route-psp1 refuses to pick up
files from the input endpoint location.

Can somebody advice me as to what I am doing wrong? I am using Camel 2.10.3.

Thanks in advance
Rajesh



--
View this message in context: http://camel.465427.n5.nabble.com/CamelContext-resume-does-not-reactivate-the-route-tp5728862.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelContext resume does not reactivate the route

Posted by "Preben.Asmussen" <pr...@dr.dk>.
I have seen the same behaviour on one or two occasions when a route 'hangs'
with an inflight exchange and you try to suspend. It seems that there might
be some issue flushing the inflight exchange (threading/interrupt) ? After
the DefaultShutDownStrategy has completed you are not able to resume.  We
run camel in war deployment and restarting the app. doesn't solve it. The
jvm had to be restarted to get it up and running again.

/preben



--
View this message in context: http://camel.465427.n5.nabble.com/CamelContext-resume-does-not-reactivate-the-route-tp5728862p5728872.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelContext resume does not reactivate the route

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I assume fromLocation is a file endpoint?

You can try setting option runLoggingLevel=INFO, then Camel logs a
INFO level when the file consumer runs on each poll. Then you can see
if that loggings does not resume when you resume Camel.

Also with JMX you can take a look at the scheduled thread pool the
file consumer uses, under threadpools. and see if its task count goes
up. Or if there core thread count is not 1.

There has been this odd situation in the past that the scheduled
thread pool seems "vanished" and didn't kick in new tasks as it was
supposed to. And that is usually if there was a java.lang.Error or
something that escaped the runnable task, causing the thread pool to
not reschedule a task. We do have try .. catch for this now.







On Mon, Mar 11, 2013 at 5:29 AM, rajesh_h <ra...@hotmail.com> wrote:
> Here is the route-psp1
>
> // Processing one csv file at a time
> from(fromLocation).routeId("route-psp1")
>         .choice()
>                 .when(simple("${file:ext} == 'csv'")).to("direct:csv")
>                 .otherwise().log("Ignoring unknown file ${file:name}");
>
> // And here is route-psp2, which streams 1000 lines at a time and processes
> them.
> from("direct:csv").routeId("route-psp2")
>                         .process(new LogFileInitializer())                              // Initialize the File Appender
>                         .log("Processing file ${file:name}")
>                         .beanRef("pspWorkingContext", "initialize")             // Initialize the working
> context
>                         .split().tokenize("\n", 1000).streaming()               // Stream 1000 lines at a time
>                                 .log("Stream the next 1000 lines")
>                                 .to("direct:thousands")
>                         .end()
>                         .log("Processed file ${file:name}")                             // Done processing the file.
>                         .choice()
>                                 .when().method("pspWorkingContext", "stopRoute")        // If the route was
> stopped, move to retry location.
>                                         .log("Moving file ${file:name} to retry location as r-${file:name}")
>                                         .to(getRetryEndPoint()).end()
>                         .beanRef("pspWorkingContext", "done")
>                 .to(getToEndPoint());
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CamelContext-resume-does-not-reactivate-the-route-tp5728862p5728913.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: CamelContext resume does not reactivate the route

Posted by rajesh_h <ra...@hotmail.com>.
Here is the route-psp1

// Processing one csv file at a time
from(fromLocation).routeId("route-psp1")
	.choice()
	        .when(simple("${file:ext} == 'csv'")).to("direct:csv")
		.otherwise().log("Ignoring unknown file ${file:name}");

// And here is route-psp2, which streams 1000 lines at a time and processes
them.
from("direct:csv").routeId("route-psp2")
			.process(new LogFileInitializer())				// Initialize the File Appender
			.log("Processing file ${file:name}")
			.beanRef("pspWorkingContext", "initialize")		// Initialize the working
context			
			.split().tokenize("\n", 1000).streaming()		// Stream 1000 lines at a time
				.log("Stream the next 1000 lines")
				.to("direct:thousands")
			.end()
			.log("Processed file ${file:name}")				// Done processing the file.
			.choice()
				.when().method("pspWorkingContext", "stopRoute") 	// If the route was
stopped, move to retry location.
					.log("Moving file ${file:name} to retry location as r-${file:name}")
					.to(getRetryEndPoint()).end()
			.beanRef("pspWorkingContext", "done")
		.to(getToEndPoint());





--
View this message in context: http://camel.465427.n5.nabble.com/CamelContext-resume-does-not-reactivate-the-route-tp5728862p5728913.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelContext resume does not reactivate the route

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Can you post the route for your route-psp1?



On Sat, Mar 9, 2013 at 2:23 AM, rajesh_h <ra...@hotmail.com> wrote:
> Hello experts,
>
> I have a route consuming from file endpoint and then other routes chained
> downstream using direct:.
>
> When I get a particular kind of exception, I want to be able to suspend the
> CamelContext (camelContext.suspend). And then be able to resume the Context
> from JMX.
>
> Now, what happens is that as soon as I issue "suspend context" from the
> code, it goes through the defaultShutDownStrategy and logs these messages
> for 300 seconds (expected).
>
> *INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.523 Waiting
> as there are still 5 inflight and pending exchanges to complete, timeout in
> 43 seconds.*
>
> Not sure why the 5 inflight exchanges are not getting flushed out, but
> eventually, times out and suspends the route.
>
> WARN.org.apache.camel.impl.DefaultShutdownStrategy:
> *org.apache.camel.impl.DefaultShutdownStrategy.doShutdown.191 Timeout
> occurred. Now forcing the routes to be shutdown now.
> WARN.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.531
> Interrupted while waiting during graceful shutdown, will force shutdown
> now.*
> INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
> *route-psp1* suspend complete, was consuming from:*
> Endpoint[file:///h/apps/proj/input?maxMessagesPerPoll=1&noop=false&readLock=changed*]
> INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
> route-psp2 suspend complete, was consuming from: Endpoint[direct://csv]
> INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy.doShutdown.213 Graceful
> shutdown of 6 routes completed in 300 seconds
> INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
> route-psp3 suspend complete, was consuming from:
> Endpoint[direct://thousands]
> INFO.org.apache.camel.spring.SpringCamelContext:
> org.apache.camel.impl.DefaultCamelContext.doSuspend.1353 Apache Camel 2.10.3
> (CamelContext: rdlCamelContext) is suspended in 5 minutes
> INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
> route-psp4 suspend complete, was consuming from: Endpoint[direct://update]
> INFO.com.paypal.demandgen.rdl.RdlContextController:
> com.paypal.demandgen.rdl.RdlContextController.suspend.33 Context suspended
> INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
> route-psp5 suspend complete, was consuming from:
> Endpoint[direct://stopRoute]
> INFO.org.apache.camel.impl.DefaultShutdownStrategy:
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run.556 Route:
> route-psp6 suspend complete, was consuming from:
> Endpoint[direct://suspendContext]
>
>
> Even after I resume the context using JMX, my route-psp1 refuses to pick up
> files from the input endpoint location.
>
> Can somebody advice me as to what I am doing wrong? I am using Camel 2.10.3.
>
> Thanks in advance
> Rajesh
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CamelContext-resume-does-not-reactivate-the-route-tp5728862.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen