On Fri, Jun 26, 2009 at 10:57 AM, alloyer<allo...@gmail.com> wrote: > > I see RouteDefinition uses List<FromDefinition> and List<ProcessorDefinition> > as inputs and outputs to maintain the message endpoints. It seems a route > can handle several message flows, like: > from("direct:a").to("mock:results") > from("direct:b").to("mock:results") > But in my test case, when I set a route configuration which contains the > above two line of routes, the route builder will separate this configuration > into two RouteDefinition instance. > > Route configuration form: > http://www.nabble.com/file/p24217052/routeDefinitionForm.jpg > routeDefinitionForm.jpg > Routes generated: > http://www.nabble.com/file/p24217052/routes.jpg routes.jpg > > Does the RouteDefinition always maintain only one sentence like > "from().to()" ? If not, how does it distinguish the <from,to> pairs? It uses a magic wand :)
No kidding. You have defined in your route builder that you have 2 routes. As there a 2 from() in the DSL. If you want multiple inputs to the same route you can do that as well and have 1 route from("direct:a", "direct:b").to("mock:results"); Then there is only 1 from in the DSL and thus only 1 route, but it has multiple inputs. That is not so common as most users either dont know this or usually use 1 input. This applies for the model, eg the RoutesDefinition. But at runtime Camel will generate a new route per. input, regardless if there is only 1 route model. So in this case no matter how we define the route model Camel will at runtime generate 2 x runtime rutes. It does this as it wraps a route in the EventDrivenConsumerRoute as the starting point, eg the from("direct:a"). What might be better or something we can work on in the future is to allow Camel to detect this better and reuse the same runtime route for multiple EventDrivenConsumerRoute that was defined to use the same route model. > > Thanks > -- > View this message in context: > http://www.nabble.com/Does-the-RouteDefinition-instance-contain-only-one-route--tp24217052p24217052.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus