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

ASF GitHub Bot commented on CAMEL-8460:
---------------------------------------

GitHub user msparer opened a pull request:

    https://github.com/apache/camel/pull/668

    adapted the changes of CAMEL-8460 to only refresh routes on ContextRe…

    …freshEvents from "own" applicationContext. Previously route refreshs were 
initiated only if the parent applicationContext of the event's context was 
null. This doesn't work when Spring instantiates the Camel's application 
context as child of another applicationContext. This e.g. happens as soon as 
you're using spring-cloud-config.
    
    This proposed change brings back RouteCollector's constructor from camel 
version 2.15.2 and aims to fix both [the initial reason for the 
change](https://github.com/spring-cloud/spring-cloud-netflix/issues/438) and 
the [bug introduced with the 
change](https://issues.apache.org/jira/browse/CAMEL-8460).
    
    Furthermore it should replace 
[PR#666](https://github.com/apache/camel/pull/666)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/msparer/camel master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/668.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #668
    
----
commit 7d56055294e0bfe13acd336945e10249f37b3531
Author: msparer <[email protected]>
Date:   2015-11-03T11:01:14Z

    adapted the changes of CAMEL-8460 to only refresh routes on 
ContextRefreshEvents from "own" applicationContext. Previously route refreshs 
were initiated only if the parent applicationContext of the event's context was 
null. This doesn't work when Spring instantiates the Camel's application 
context as child of another applicationContext. This e.g. happens as soon as 
you're using spring-cloud-config

----


> 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)

Reply via email to