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



From:
Willem Jiang <[email protected]>
To:
[email protected]
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  

Reply via email to