padcom / grails-routing

Apache License 2.0
30 stars 31 forks source link

Auto startup of routes failing when camel context autostartup = false #54

Open mtgleeson opened 8 years ago

mtgleeson commented 8 years ago

I've created a new Grails (2.4.4) project with the routing plugin 1.4.1. I created a simple route but noticed that when I started the app it was starting the camel context but it wasn't auto starting the route ("Skipping starting of route XX as its configured with autoStartup=false").

The route is configured with autoStartup(true). I found that since Camel 2.12.5 if the camel context autoStartup=false then routes won't auto start and instead we have to use startAllRoutes() manually.

In RoutingGrailsPlugin the camelContext is defined with autoStartup:false which is causing the routes to not start automatically.

I would recommend adding startAllRoutes to RoutingGrailsPlugin.doWithDynamicMethods if (config.autoStartup != false). Or put a note up on the home page so new users are aware.

I'm currently starting all routes via Bootstrap.groovy: def camelContextId = grailsApplication.config.grails.routing.camelContextId grailsApplication.mainContext.getBean(camelContextId).startAllRoutes()

For more details read - http://camel.465427.n5.nabble.com/migrating-from-Camel-2-13-1-to-2-15-1-suddenly-all-routes-not-starting-td5765551.html

aahutsal commented 8 years ago

Thanks for your contribution. However, that plugin is not maintained any longer by origin authors. If you wish to contribute - I'll give you maintainer rights.

aahutsal commented 8 years ago

Btw - I've noticed that change been already applied in that fork: https://github.com/kenschwartz/grails-routing/commit/4c16c5c737bf873746a413271b4a5fbe8c94a4b1