You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Anestis Georgiadis (JIRA)" <ji...@apache.org> on 2015/10/31 21:21:28 UTC

[jira] [Commented] (CAMEL-8460) camel-spring-boot - Routes restart during startup

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

Anestis Georgiadis commented on CAMEL-8460:
-------------------------------------------

Fix as implemented fails to properly initialize Camel context when Spring instantiates the application context as a child of another, parent context. This is the case for example when using spring-cloud-config. See:

http://projects.spring.io/spring-cloud/docs/1.0.3/spring-cloud.html#_the_bootstrap_application_context

As soon as spring-cloud-config is enabled in a camel spring boot application (i.e. include the org.springframework.cloud:spring-cloud-starter-config dependency) Camel context does not get to be initialized, as test expression at line 58 evaluates to false even for the initial context refresh event at application initialization.

The same problem will arise for any applications that use Spring Boot's fluent builder API (see: http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-spring-application.html#boot-features-fluent-builder-api) that provides methods to programmatically create multiple contexts with a parent/child relationship.

> camel-spring-boot - Routes restart during startup
> -------------------------------------------------
>
>                 Key: CAMEL-8460
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8460
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring-boot
>    Affects Versions: 2.15.0
>            Reporter: Steven Marcus
>            Assignee: Henryk Konsek
>             Fix For: 2.15.3, 2.16.0
>
>
> The latest snapshot fixes the issue with my routes not being found.
> But there is still some undesirable behaviour with routes being restarted during the context refresh.
> Here's the console log that shows shutdown handlers being run during app startup... tia
> .   ____          _            __ _ _
> /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
> ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
> \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
> '  |____| .__|_| |_|_| |_\__, | / / / /
> =========|_|==============|___/=/_/_/_/
> :: Spring Boot ::        (v1.2.2.RELEASE)
> 2015-03-09 08:40:55.162  INFO 81935 --- [           main] mediaroom.MRServicesApp                  : Starting MRServicesApp on MBP13.local with PID 81935 (/Users/srnm/Documents/workspace-buffdubs/MRServices/target/classes started by srnm in /Users/srnm/Documents/workspace-buffdubs/MRServices)
> 2015-03-09 08:40:55.165 DEBUG 81935 --- [           main] mediaroom.MRServicesApp                  : Running with Spring Boot v1.2.2.RELEASE, Spring v4.1.5.RELEASE
> ...
> [AppClassLoader@14dad5dc] info AspectJ Weaver Version 1.8.5 built on Thursday Jan 29, 2015 at 01:03:58 GMT
> [AppClassLoader@14dad5dc] info register classloader sun.misc.Launcher$AppClassLoader@14dad5dc
> [AppClassLoader@14dad5dc] info using configuration /Users/srnm/Documents/workspace-buffdubs/MRServices/src/main/resources/META-INF/aop.xml
> [AppClassLoader@14dad5dc] info register aspect com.amazonaws.services.simpleworkflow.flow.aspectj.AsynchronousAspect
> [AppClassLoader@14dad5dc] info register aspect com.amazonaws.services.simpleworkflow.flow.aspectj.ExponentialRetryAspect
> [AppClassLoader@14dad5dc] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified
> 2015-03-09 08:41:03.406  INFO 81935 --- [           main] o.a.c.i.converter.DefaultTypeConverter   : Loaded 183 type converters
> 2015-03-09 08:41:04.345 DEBUG 81935 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Post-processing CamelContext bean: camel-1
> 2015-03-09 08:41:04.346 DEBUG 81935 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Injecting following route into the CamelContext: Routes: []
> 2015-03-09 08:41:04.394  INFO 81935 --- [           main] o.a.camel.component.log.LogComponent     : Using custom Logger: Logger[camelLogger]
> 2015-03-09 08:41:04.630 DEBUG 81935 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Injecting following route into the CamelContext: Routes: []
> 2015-03-09 08:41:04.632  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.15-SNAPSHOT (CamelContext: camel-1) is starting
> 2015-03-09 08:41:04.633  INFO 81935 --- [           main] o.a.c.m.ManagedManagementStrategy        : JMX is enabled
> 2015-03-09 08:41:04.932  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
> 2015-03-09 08:41:04.932  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
> 2015-03-09 08:41:05.089  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: roomSyncDLQ started and consuming from: Endpoint[direct://roomSyncDLQ]
> 2015-03-09 08:41:05.090  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: syncAllRooms started and consuming from: Endpoint[timer://roomSyncTimer?delay=3s&period=30s]
> 2015-03-09 08:41:05.092  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: writeRoomSync started and consuming from: Endpoint[direct://writeRoomSync]
> 2015-03-09 08:41:05.095  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: updateRoomRepo started and consuming from: Endpoint[direct://updateRoomRepo]
> 2015-03-09 08:41:05.096  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowDLQ started and consuming from: Endpoint[direct://transcodeWorkflowDLQ]
> 2015-03-09 08:41:05.098  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowStart started and consuming from: Endpoint[direct://transcodeWorkflowStart]
> 2015-03-09 08:41:05.106  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Total 6 routes, of which 6 is started.
> 2015-03-09 08:41:05.108  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.15-SNAPSHOT (CamelContext: camel-1) started in 0.474 seconds
> ...
> 2015-03-09 08:41:07.020 DEBUG 81935 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Post-processing CamelContext bean: camel-1
> 2015-03-09 08:41:07.022 DEBUG 81935 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Injecting following route into the CamelContext: Routes: [Route(roomSyncDLQ)[[From[direct://roomSyncDLQ]] -> [To[browse:roomSyncDLQ]]], Route(syncAllRooms)[[From[timer://roomSyncTimer?delay=3s&period=30s]] -> [process[Processor@0x64910b2d], Split[{body} -> [process[Processor@0x1247c72e], process[Processor@0x6fef75c6], Multicast[[To[direct://writeRoomSync], To[direct://updateRoomRepo], To[direct://transcodeWorkflowStart]]]]]]], Route(writeRoomSync)[[From[direct://writeRoomSync]] -> [Choice[[When[simple{${body.isNoChange}} -> [To[log://?level=OFF]]]] Otherwise[[process[Processor@0x5f61e002], Marshal[org.apache.camel.model.DataFormatDefinition@334540a0], To[file:///Users/srnm/MR-reports/RoomSync?fileExist=Fail&fileName=%24%7Bfile%3Aonlyname.noext%7D.json&tempFileName=%24%7Bfile%3Aonlyname.noext%7D_%24%7Bfile%3Aname.ext%7D.inprogress]]]]]], Route(updateRoomRepo)[[From[direct://updateRoomRepo]] -> [Split[{ognl(body, asUpdatesJava)} -> [process[Processor@0x1f179f51], To[browse:updateRoomRepoComplete]]]]]]
> 2015-03-09 08:41:07.023  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
> 2015-03-09 08:41:07.029  INFO 81935 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Route: roomSyncDLQ shutdown complete, was consuming from: Endpoint[direct://roomSyncDLQ]
> 2015-03-09 08:41:07.029  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds
> 2015-03-09 08:41:07.031  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: roomSyncDLQ is stopped, was consuming from: Endpoint[direct://roomSyncDLQ]
> 2015-03-09 08:41:07.032  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: roomSyncDLQ is shutdown and removed, was consuming from: Endpoint[direct://roomSyncDLQ]
> 2015-03-09 08:41:07.034  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
> 2015-03-09 08:41:07.035  INFO 81935 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Route: syncAllRooms shutdown complete, was consuming from: Endpoint[timer://roomSyncTimer?delay=3s&period=30s]
> 2015-03-09 08:41:07.035  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds
> 2015-03-09 08:41:07.037  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: syncAllRooms is stopped, was consuming from: Endpoint[timer://roomSyncTimer?delay=3s&period=30s]
> 2015-03-09 08:41:07.038  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: syncAllRooms is shutdown and removed, was consuming from: Endpoint[timer://roomSyncTimer?delay=3s&period=30s]
> 2015-03-09 08:41:07.039  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
> 2015-03-09 08:41:07.039  INFO 81935 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Route: writeRoomSync shutdown complete, was consuming from: Endpoint[direct://writeRoomSync]
> 2015-03-09 08:41:07.039  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds
> 2015-03-09 08:41:07.040  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: writeRoomSync is stopped, was consuming from: Endpoint[direct://writeRoomSync]
> 2015-03-09 08:41:07.041  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: writeRoomSync is shutdown and removed, was consuming from: Endpoint[direct://writeRoomSync]
> 2015-03-09 08:41:07.042  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
> 2015-03-09 08:41:07.042  INFO 81935 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Route: updateRoomRepo shutdown complete, was consuming from: Endpoint[direct://updateRoomRepo]
> 2015-03-09 08:41:07.043  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds
> 2015-03-09 08:41:07.044  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: updateRoomRepo is stopped, was consuming from: Endpoint[direct://updateRoomRepo]
> 2015-03-09 08:41:07.045  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: updateRoomRepo is shutdown and removed, was consuming from: Endpoint[direct://updateRoomRepo]
> 2015-03-09 08:41:07.057  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: roomSyncDLQ started and consuming from: Endpoint[direct://roomSyncDLQ]
> 2015-03-09 08:41:07.091  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: syncAllRooms started and consuming from: Endpoint[timer://roomSyncTimer?delay=3s&period=30s]
> 2015-03-09 08:41:07.113  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: writeRoomSync started and consuming from: Endpoint[direct://writeRoomSync]
> 2015-03-09 08:41:07.129  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: updateRoomRepo started and consuming from: Endpoint[direct://updateRoomRepo]
> 2015-03-09 08:41:07.129 DEBUG 81935 --- [           main] o.a.camel.spring.boot.RoutesCollector    : Injecting following route into the CamelContext: Routes: [Route(transcodeWorkflowDLQ)[[From[direct://transcodeWorkflowDLQ]] -> [To[browse:transcodeWorkflowDLQ]]], Route(transcodeWorkflowStart)[[From[direct://transcodeWorkflowStart]] -> [process[Processor@0x4a6a6a69]]]]
> 2015-03-09 08:41:07.130  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
> 2015-03-09 08:41:07.130  INFO 81935 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Route: transcodeWorkflowDLQ shutdown complete, was consuming from: Endpoint[direct://transcodeWorkflowDLQ]
> 2015-03-09 08:41:07.130  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds
> 2015-03-09 08:41:07.131  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowDLQ is stopped, was consuming from: Endpoint[direct://transcodeWorkflowDLQ]
> 2015-03-09 08:41:07.132  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowDLQ is shutdown and removed, was consuming from: Endpoint[direct://transcodeWorkflowDLQ]
> 2015-03-09 08:41:07.132  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
> 2015-03-09 08:41:07.132  INFO 81935 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Route: transcodeWorkflowStart shutdown complete, was consuming from: Endpoint[direct://transcodeWorkflowStart]
> 2015-03-09 08:41:07.133  INFO 81935 --- [           main] o.a.camel.impl.DefaultShutdownStrategy   : Graceful shutdown of 1 routes completed in 0 seconds
> 2015-03-09 08:41:07.133  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowStart is stopped, was consuming from: Endpoint[direct://transcodeWorkflowStart]
> 2015-03-09 08:41:07.134  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowStart is shutdown and removed, was consuming from: Endpoint[direct://transcodeWorkflowStart]
> 2015-03-09 08:41:07.144  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowDLQ started and consuming from: Endpoint[direct://transcodeWorkflowDLQ]
> 2015-03-09 08:41:07.150  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Route: transcodeWorkflowStart started and consuming from: Endpoint[direct://transcodeWorkflowStart]
> 2015-03-09 08:41:07.151  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.15-SNAPSHOT (CamelContext: camel-1) is starting
> 2015-03-09 08:41:07.151  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Total 6 routes, of which 6 is started.
> 2015-03-09 08:41:07.151  INFO 81935 --- [           main] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.15-SNAPSHOT (CamelContext: camel-1) started in 0.000 seconds
> 2015-03-09 08:41:07.164  INFO 81935 --- [           main] mediaroom.MRServicesApp                  : Started MRServicesApp in 12.586 seconds (JVM running for 13.145)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)