简体   繁体   中英

camel OptaplannerComponent in osgi

I have camel running on karaf and I would like to use the OptaplannerComponent to ingest a problem from xml file and send the solution to a jms queue.

I am wondering how I can make optaplanner find my domainmodel and the solverConfig.xml in its classloader . Ideally, the model and the config should be installable as a bundle that can be easily swapped at runtime.

I see that OptaPlannerEndpoint loads the config like this:

ClassLoader classLoader = getCamelContext().getApplicationContextClassLoader();
    solverFactory = SolverFactory.createFromXmlResource(configuration.getConfigFile(), classLoader);

Is it possible to get my domainmodel into that classloader somehow?

Take a look at this test . I presume if you put your domain objects and solver config into a jar and add that to your dependencies, it should work?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM