You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by wantastic <Wa...@barclays.com> on 2012/07/26 21:54:15 UTC

Camel Graceful Shutdown not flushing Seda queue

Hello all,

I have been trying to see how I can gracefully shutdown the process in case
of emergency.
Here are the routes:

<route shutdownRunningTask="CompleteAllTasks">
	<from
uri="jms:queue:my-queue-url?acknowledgementModeName=CLIENT_ACKNOWLEDGE" />
	<wireTap uri="dataLogger" executorServiceRef="dataLoggerPool" />
	<to uri="seda:processMsg?size=100&amp;blockWhenFull=true" />        
</route>
<route shutdownRunningTask="CompleteAllTasks" shutdownRoute="Defer">
	<from uri="seda:processMsg?concurrentConsumers=10" />
	<to uri="messageValidation" />
	<to uri="messageConversion" />
	<to uri="messangePersistence" />
	<to uri="messageCounter" />
	<choice>
		<when>
			<simple>${in.header.errors} != null</simple>
			<to uri="errorHandler" />
		</when>
	</choice>
</route>

When the number of errors reaches to a certain level, 'errorHandler' will
try to "System.exit(0)" to shut down the process. However, I want to have
all messages in the SEDA queue to be processed before the process shuts down
completely. 

I have tested with 100 messages on the queue and made errorHandler to exit
out at a certain count. When it stops around 73, I still see the countdown
and the number of inflight messages do not get reduced.

2012-07-26 15:28:28,524  INFO [Camel (pnsContext) thread #13 - ShutdownTask]
- Waiting as there are still 27 inflight and pending exchanges to complete,
timeout in 98 seconds.
2012-07-26 15:28:29,524  INFO [Camel (pnsContext) thread #13 - ShutdownTask]
- Waiting as there are still 27 inflight and pending exchanges to complete,
timeout in 97 seconds.
2012-07-26 15:28:30,523  INFO [Camel (pnsContext) thread #13 - ShutdownTask]
- Waiting as there are still 27 inflight and pending exchanges to complete,
timeout in 96 seconds.

Is there way to let all messages be processed once the shutdown is
triggered? According to the wiki, SEDA implements ShutdownAware so that it
will keep processing the in-queue messages.

Thank you all for your support,

Wan




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Graceful-Shutdown-not-flushing-Seda-queue-tp5716535.html
Sent from the Camel - Users mailing list archive at Nabble.com.