You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (JIRA)" <ji...@apache.org> on 2017/08/04 14:25:00 UTC

[jira] [Commented] (CAMEL-11588) SupervisingRouteController - Routes may be started in wrong order

    [ https://issues.apache.org/jira/browse/CAMEL-11588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16114428#comment-16114428 ] 

Luca Burgazzoli commented on CAMEL-11588:
-----------------------------------------

As workaround I've added an additional counter to keep track of the order of which routes are initialized so the rule is now:

- compare startup order
- if not defined compare using the initialization order

So assuming we have:

{code:java}
from("undertow:http://localhost:9013")
    .id("undertow-9013")
    .log("From undertow ...");

from("timer:foo?period=5s")
    .id("foo")
    .startupOrder(2)
    .log("From timer (foo) ...");

from("timer:bar?period=5s")
    .id("bar")
    .startupOrder(1)
    .log("From timer (bar) ...");

from("undertow:http://localhost:9011")
    .id("undertow-9011")
    .log("From undertow ...");

from("undertow:http://localhost:9010")
    .id("undertow-9010")
    .log("From undertow ...");
{code}

The startup order will be:

- bar
- foo
- undertow-9013
- undertow-9011
- undertow-9010


> SupervisingRouteController - Routes may be started in wrong order
> -----------------------------------------------------------------
>
>                 Key: CAMEL-11588
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11588
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Claus Ibsen
>            Assignee: Luca Burgazzoli
>              Labels: route-controller
>             Fix For: 2.20.0
>
>
> If you run the example and turn off the supervising
> Then the routes are started correct order
> {code}
> 2017-07-23 10:40:37.825  INFO 33034 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: bar started and consuming from: timer://bar?period=5s
> 2017-07-23 10:40:37.825  INFO 33034 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: foo started and consuming from: timer://foo?period=5s
> 2017-07-23 10:40:37.830  INFO 33034 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Starting Undertow server on http://localhost:9011
> 2017-07-23 10:40:37.877  INFO 33034 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: undertow started and consuming from: http://localhost:9011
> {code}
> eg with lowest startup order first, 1,2, (no number).
> But if you turn on supervising, then they are started: (no number), 1, 2
> {code}
> 2017-07-23 10:37:39.266  INFO 32985 --- [           main] o.a.c.c.undertow.DefaultUndertowHost     : Starting Undertow server on http://localhost:9011
> 2017-07-23 10:37:39.311  INFO 32985 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: undertow started and consuming from: http://localhost:9011
> 2017-07-23 10:37:39.313  INFO 32985 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: bar started and consuming from: timer://bar?period=5s
> 2017-07-23 10:37:39.314  INFO 32985 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: foo started and consuming from: timer://foo?period=5s
> {code}
> eg the undertow route is the (no number) and should therefore be started last (it will have auto assigned number 1001).
> eg we need to use the RouteStartupOrder that can tell the correct order.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)