Grokbase Groups Camel users June 2010
FAQ
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.

Search Discussions

  • Claus Ibsen at Jun 18, 2010 at 4:46 am
    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 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedJun 18, '10 at 4:41a
activeJun 18, '10 at 4:46a
posts2
users2
websitecamel.apache.org

2 users in discussion

Claus Ibsen: 1 post Tom McGee: 1 post

People

Translate

site design / logo © 2022 Grokbase