It looks like the answer is maybe yes. The original idea I think was to treat the (or a subset of the) Java DSL as if it were just a routing script language. But some other scripting language, or even -- as suggested -- XML could be just as effective.
The use case is to dynamically set up, pause, resume, and tear down routes between services dynamically, using an additional subscription-like interface. Perhaps patterned on WSN. From: Claus Ibsen Sent: Fri 3/25/2011 3:04 AM To: users@camel.apache.org Subject: Re: DSL Parser On Fri, Mar 25, 2011 at 11:01 AM, <mitko.ko...@icw.de> wrote: > Hi, > > maybe it would be helpful to share what is your usecase for such > functionality. I suppose you have already considered > http://camel.apache.org/dynamic-router.html and the Camel WebConsole > proposed. > > Technically speaking such parser code exists for the Spring DSL[2] and for > the Java DSL it could easy be implemented: > > It should be able to add routes to the CamelContext at runtime, so: > 1) Write a groovy script as test - a closure that returns a RouteBuilder > with a parameter CamelContext: here is some pseudocode: > import ... > def routeBuilder = { context-> > return new RouteBuilder(context){ > public void configure(){ > //your route is here. > } > } > } > 2) Compile the script with GroovyShell (see example how to do this in the > Groovy project) > then > 3) Add the routes to a the CamelContex (context.addRoutes(RoutesBuilder)) > after evaluating the Closure. > > Regards, > Mitko > > [2] > https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/RouteResource.java > Yes scripting languages can/should be used for such solutions. However you can define routes in XML and have them loaded and added to CamelContext. http://camel.apache.org/loading-routes-from-xml-files.html > > > From: > Willem Jiang <willem.ji...@gmail.com> > To: > users@camel.apache.org > Date: > 25.03.2011 10:05 > Subject: > Re: DSL Parser > > > > Camel WebConsole[1] supports to update the camel route dynamically. > You may take a look at it. > > [1]http://camel.apache.org/web-console.html > > Willem > > On 3/25/11 6:37 AM, Lansing, William Jeff wrote: >> A while ago I read a suggestion to the effect that it would be nice if > routes could be declared as strings, e.g., in a file like: >> >> from("ds-service:events") >> .filter().simple("${body.provider} not contains > 'side-effect-of-delete'") >> .to("ds-soap://update?url=http://localhost/xyz/UpdateService") >> ; >> >> The advantage would be that routes could be created dynamically at > runtime by parsing such declarations. >> >> (I can't find the doc that suggested this now but it was on the Camel > site at one time.) >> >> Has this been done? >> > > > -- > Willem > ---------------------------------- > FuseSource > Web: http://www.fusesource.com > Blog: http://willemjiang.blogspot.com (English) > http://jnn.javaeye.com (Chinese) > Twitter: willemjiang > > > > > > > > InterComponentWare AG: > Vorstand: Peter Kirschbauer (Vors.), Jörg Stadler > Aufsichtsratsvors.: Prof. Dr. Christof Hettich > Firmensitz: 69190 Walldorf, Altrottstraße 31 > AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516 -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/