I am using a route builder in my Camel Context like this:
<bean class="mypackage.MyRouteBuilder" id="MyRouteBuilder"/> <camelContext id="mypackage.camelcontext" xmlns="http://camel.apache.org/schema/spring"> <routeBuilder ref="MyRouteBuilder"/> </camelContext>
I have implemented a RouteBuilder like this:
public class MyRouteBuilder extends RouteBuilder{ @Override public void configure() { from("direct:MyRouteBuilder") .log("Route Builder: ${body}"); } }
Is it possible to implement more routes in the same route builder?
Advertisement
Answer
yes you can implement a lot of routes in the same route builder like this, I advise you to use routeId for identify the route in the logs and use the .end() to finish the block
from("direct:route1") .routeId("route1") .log("Route Builder: ${body}") .end(); from("direct:route2") .routeId("route2") .log("Route Builder: ${body}") .end(); from("direct:route3") .routeId("route3") .log("Route Builder: ${body}") .end();