Reputation: 21
I am relatively new to Camel. I have a use case where I need to instantiate a RouteBuilder only when it receives get an exchange to kickstart the process from an Orchestration module. I am trying to do this mainly because, the exchange carries information required to instantiate the new RouteBuilder
. Is there a way where I could instantiate this new RouteBuilderB
from inside a route in the existing RouteBuilderA
.
public class RouteBuilderA extends RouteBuilder {
public void configure(){
//So, something like this?
from("direct:A")
.process(//new RouteBuilderB())
.to("direct:B")
}
Is there a way to accomplish this?
Upvotes: 2
Views: 466
Reputation: 55545
Yes its just Java code, so write a Processor
that creates the RoutBuilder
instance you want, and do any configuration with setter/getter etc. And then you can add that as routes to CamelContext
using the addRoutes
method.
Upvotes: 1