Hello,

I'm in migration of a program Came 2.25 to 3.18.6, and there is something i can't fix. It seems like camel-spring-main & addRoutesBuilder can't work together... (i'm probably missing something...)

springcontext.xml
<camel:camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
</camel:camelContext>

MyMain.java (part)
public static void main(String[] args) throws Exception {
  Main main = new org.apache.camel.spring.Main();
         main.setApplicationContextUri("springcontext.xml");
         main.configure().addRoutesBuilder(new Route1());
         main.configure().addRoutesBuilder(new Route2());
         if (condition3)
                 main.configure().addRoutesBuilder(new Route3());
         if (condition4)
                main.configure().addRoutesBuilder(new Route4());
         main.run();


Behavior with 2.25 : the log says "Total 0 routes, of which 0 are started" and just after, i see the routes in my classes Route1..Route4 start (seen by "Route: Route1 started and consuming from:..." ) and only the wanted routes depending on the conditions.

Behavior with 3.18.6 : when i start my app, i see "Routes startup (started:0)", and nothing after that. I also tested to add <packageScan> in the camelContext, With that, all the routes starts OK, but no conditions possible...

How can i have a situation like old 2.25 ?

Thanks

Reply via email to