All,
I have a Camel/Spring configuration. For example:
BEGIN_CODE_SNIPPET
<?xml version="1.0" encoding="UTF-8"?>
[SNIP]
<camel:camelContext id="camelContext">
<camel:routeBuilder ref="RouteBuilder1" />
<camel:routeBuilder ref="RouteBuilder2" />
</camel:camelContext>
</beans>
END_CODE_SNIPPET
The RouteBuilders, above, dynamically create the query portion of the "from"
endpoints (e.g. from an SQL query). Eventually, a "change event" occurs
(handled by an existing route) and I'd like to essentially re-initialize the
CamelContext/RouteBuilders (so that they can re-build their query
parameters) without having to take down the application. I'm relatively new,
so I might be missing something obvious, but it looks like my options are
(for 2.7.X camel):
1 - Use camelcontext to get all the routes and edit the "from" URIs in
place. This solution would be similar to:
http://camel.465427.n5.nabble.com/starting-stopping-creating-amp-editing-routes-at-runtime-now-works-CAMEL-1004-td491958.html.
The downsides are a) that getting RouteDefinitions is deprecated in future
version of camel (so it would probably break upon upgrading) and b) I may
not want to do a blanket search-and-replace because the original
RouteBuilder might have some "extra" logic in it.
2 - Get a handle to the camelContext and RouteBuilders from a Spring-aware
bean, stop/remove all existing routes via the camelContext, and then
re-initialize the camelContext with "new", uninitialized instances of the
routeBuilder classes found via Spring's ApplicationContext[1].
I suspect I could get either option to work, but they seem non-optimal. I
have a sneaking suspicion that I'm perhaps missing a more elegant solution.
Is there a camel "way" to accomplish this effect?
Notes:
[1] There is the question of excluding the route handling the "change" event
from being stopped/removed/re-initialized
--
View this message in context:
http://camel.465427.n5.nabble.com/Re-initializing-route-builders-at-runtime-under-Spring-tp5660040p5660040.html
Sent from the Camel - Users mailing list archive at Nabble.com.