Hi

This has been improved in Camel 2.4 which now shutdown manually added
/ started routes as well.
http://camel.apache.org/camel-240-release.html



On Fri, Jun 18, 2010 at 6:40 AM, Tom McGee <t.mcgee.lazy...@gmail.com> wrote:
>
> Maybe I doing something wrong or maybe I'm misinterpreting the logging
> messages but it looks like routes added to a camel context after that
> context has started do not go through  the graceful shutdown after the
> context is stopped. Here's some example code:
>
>        public static void main(String[] args) throws Exception {
>                SimpleRegistry registry = new SimpleRegistry();
>                CamelContext context = new DefaultCamelContext(registry);
>                context.addRoutes(new RouteBuilder(){
>                       �...@override
>                        public void configure() throws Exception {
>
> from("file:src/data?noop=true").id("aaa").to("seda:zoth");
>                        }});
>                context.start();
>                context.addRoutes(new RouteBuilder(){
>                       �...@override
>                        public void configure() throws Exception {
>
> from("seda:zoth").id("bbb").to("file:target/messages/zoth");
>                        }});
>                Thread.sleep(10000);
>                context.stop();
>        }
>
> Here's the logging output:
> [                          main] DefaultCamelContext            INFO  Apache
> Camel 2.3.0 (CamelContext: camel-1) is starting
> [                          main] DefaultCamelContext            INFO  JMX
> enabled. Using ManagedManagementStrategy.
> [                          main] AnnotationTypeConverterLoader  INFO  Found
> 3 packages with 14 @Converter classes to load
> [                          main] DefaultTypeConverter           INFO  Loaded
> 142 type converters in 510 millis
> [                          main] FileEndpoint                   INFO
> Endpoint is configured with noop=true so forcing endpoint to be idempotent
> as well
> [                          main] FileEndpoint                   INFO  Using
> default memory based idempotent repository with cache max size: 1000
> [                          main] DefaultCamelContext            INFO  Route:
> aaa started and consuming from: Endpoint[file://src/data?noop=true]
> [                          main] DefaultCamelContext            INFO
> Started 1 routes
> [                          main] DefaultCamelContext            INFO  Apache
> Camel 2.3.0 (CamelContext: camel-1) started in 1246 millis
> [                          main] DefaultCamelContext            INFO  Apache
> Camel 2.3.0 (CamelContext:camel-1) is shutting down
> [                          main] DefaultShutdownStrategy        INFO
> Starting to graceful shutdown 1 routes (timeout 300 seconds)
> [ Camel Thread 2 - ShutdownTask] DefaultShutdownStrategy        INFO  Route:
> aaa suspended and shutdown deferred, was consuming from:
> Endpoint[file://src/data?noop=true]
> [ Camel Thread 2 - ShutdownTask] DefaultShutdownStrategy        INFO  Route:
> aaa shutdown complete.
> [                          main] DefaultShutdownStrategy        INFO
> Graceful shutdown of 1 routes completed in 0 seconds
> [                          main] DefaultInflightRepository      INFO
> Shutting down with no inflight exchanges.
> [                          main] DefaultCamelContext            INFO  Apache
> Camel 2.3.0 (CamelContext: camel-1) is shutdown in 18 millis
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/No-graceful-shutdown-for-routes-added-after-the-CamelContext-is-started-tp510041p510041.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to