It’s not a good idea to setup the camel context inside the RouteBuilder, as it
could have some side effect on the other RouteBuilder.
CamelContext support to inject the registry, but it doesn’t supper to
addRoutePolicyFactory.
You may need to find other way to add the RoutePolicyFactory, such as extends
the GuiceCamelContext to made the startUpLogic injectable.
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On November 25, 2014 at 5:11:07 PM, dermoritz (tantea...@hotmail.com) wrote:
i am using guice in conjunction with CamelModule in my camel application
(standalone using Main). In my case i need to do some things on the context
before starting it:
context.addRoutePolicyFactory(startUpLogic);
context.getRegistry(JndiRegistry.class).bind(CepModule.LOOKUP_DATASOURCE,
ds);
But i am not sure where to put this lines. At the moment this lines are
added in constructor of my main RouteBuilder that is adding all other
RoutBuilders. (do context setup stuff in route builder feels wrong)
Alternativly i could put this lines into this method (mandatory if using
CepModule)
@Provides
@Inject
private Set getRoutes(final RouteBuilder routes)
I just would inject context but it also feels wrong to do this here. So is
there a good way/practice to hook into before starting and doing this kind
of setup?
thanks in advance
--
View this message in context:
http://camel.465427.n5.nabble.com/Where-to-do-context-setup-stuff-in-a-guice-enabled-camel-app-tp5759574.html
Sent from the Camel - Users mailing list archive at Nabble.com.