camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gludington <>
Subject Shutting down camel and consumers
Date Fri, 28 Jul 2017 04:12:57 GMT
When I attempt to shutdown a camel context, the main thread stays open,
seemingly parked on the consumer.  For example, using a small variation on
the console sample (at end of message), which uses stream:in and stream:out,
I can start up a context, either using a SpringCamelContext or using
org.apache.camel.spring.Main.  However, when I stop the context using
camelContext.stop() in a separate thread, the context stops, but not
everything is released.  In the log, I will see all the messages, concluding

23:52:14.711 [pool-2-thread-1] INFO
org.apache.camel.spring.SpringCamelContext - Apache Camel 2.19.0
(CamelContext: camel-1) uptime 42.866 seconds
23:52:14.713 [pool-2-thread-1] INFO
org.apache.camel.spring.SpringCamelContext - Apache Camel 2.19.0
(CamelContext: camel-1) is shutdown in 27.621 seconds

Stepping through the debugger I can see that StreamConsumer#doStop is
called, but a thread dump shows the camel-1 thread is still parked on
reading a line

I saw similar behavior with a file consumer, as well.  Is there a proper way
to shut down all consumers as well when shutting down a camel context, so
that I can kill a specific spring context and release all resources without
shutting down the entire application?

The context in question:
<camelContext xmlns="">
    	<from uri="stream:in?promptMessage=Enter something: "/>
                <simple>${body} == 'cash'</simple>
                <log message="I HAVE CASH" loggingLevel="INFO"
                <simple>${body} == 'credit'</simple>
				<log message="GIVE ME CREDIT" loggingLevel="INFO" logName="Test"/>
                <log message="Excuse me, WHAT IS ${body}"
loggingLevel="INFO" logName="Test"/>

    <to uri="stream:out"/>


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message