On 20/09/2016 16:45, Colm O hEigeartaigh wrote:
Hi all,

I've run into a problem with the way we set Camel up in Syncope. The
use-case is when you want to modify one of the routes to use a Camel
component that requires a pre-defined bean in the Camel Registry. There is
no way to do this in the console as you can only edit the routes, and not
define beans that are referenced in the routes.

In the SyncopeCamelContext class, we obtain a SpringCamelContext instance
via:

new SpringCamelContext(ApplicationContextProvider.getApplicationContext());

where ApplicationContextProvider is in the syncope-core-spring module. I
had in mind something like the following:

ApplicationContext appContext =
                     new ClassPathXmlApplicationContext("camel-beans.xml");
camelContext = new SpringCamelContext(appContext);

So the user could just add whatever beans are required in camel-beans.xml
at deployment time, and they would be available to the routes. This doesn't
work however, as the routes complain that they can't find the uwfAdapter
bean.

Any thoughts on how this could work?

You could do:

ApplicationContext appContext = new ClassPathXmlApplicationContext( new String[]{"camel-beans.xml"}, ApplicationContextProvider.getApplicationContext());
                camelContext = new SpringCamelContext(appContext);


e.g. setting the standard Syncope context as parent context.

It is not clear to me, however, how we could set up things to allow such (very useful, indeed) possibility.

An empty "camel-beans.xml" file (maybe camelEnv.xml would better follow the naming in use) can be added under

fit/core-reference/src/main/resources/all/

and the code above could load it only when found.
In this way the standalone distribution will simply provide the file that anyone could start customizing, while for the Maven project the reference guide [1] should be updated.

WDYT?

Regards.

[1] https://syncope.apache.org/docs/reference-guide.html#enable-the-a-href-apache-camel-provisioning-manager-apache-camel-provisioning-manager-a

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/


Reply via email to