On Wed, Jun 10, 2009 at 1:46 PM, Roman Kalukiewicz<[email protected]> wrote: > BTW The message in the Exception could be more clear. It is not > obvious what "Root node with no active block" is ;) Yeah I have been wondering if we should force a begin DSL for the few EIP types that have nested routes, to easier pair begin / end and have better errors if missing.
In Spring XML you have the XML tags start/end tag for that. So that is really an area where the XML is better than Java DSL. > > Roman > > 2009/6/10 Claus Ibsen <[email protected]>: >> On Wed, Jun 10, 2009 at 1:09 PM, Peter Maas<[email protected]> wrote: >>> Hi, >>> >>> I wondered what the purpose of the 'end' method in a route is. I sort of >>> expected it to be a terminator for dead-end routes. But that doesn't seem to >>> be the case. >>> >>> If I do something like this: >>> >>> from("direct:start") >>> .process(new Processor(){ >>> public void process(Exchange arg0) throws Exception { >>> System.out.println("hello!"); >>> } >>> }) >>> .end(); >>> >>> >>> I get the following exception: >>> >>> >>> java.lang.IllegalArgumentException: Root node with no active block >>> at >>> org.apache.camel.model.ProcessorDefinition.end(ProcessorDefinition.java:719) >>> >>> >>> I currently 'terminate' such a route by using a non-existent direct >>> endpoint, which works but raises a WARN messages... >>> >>> What is the preferred way to do this? >> Not to use end() at all. >> >> They should only be used for some special EIP that kinda have sub >> routes, such as >> - aggregator >> - splitter >> and a few others >> >> So your route should just be: >> from("direct:start") >> .process(new Processor(){ >> public void process(Exchange arg0) throws Exception { >> System.out.println("hello!"); >> } >> }); >> >> >> >>> >>> -P >>> >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
