You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Ramon Buckland <ra...@thebuckland.com> on 2009/01/27 08:24:06 UTC

XML vs a dynamic DSL

Hi all,

I have been working with Camel at a client site as a really complex file
copier, backup and transfer tool.

Because of the nature of moving paths (and shifting systems from dev to UAT
and UAT to production) we have found using XML is good for it's flexibile
change capabilities.

However, I have as usual the XML has pain, that the XML's config becomes
cumbersome (we have all been there).

the Java DSL is nice due to in place editor completion, but it is also nice
because there is no < > =" and &amp; going on.

I was wondering, has anyone thought of (or is there) a dynamic form of the
Java DSL .. like .. jsp's or the old jws files in Axis, which are compiled
on demand.

ie, (and thinking inside AMQ) on boot

<camelContext id="camel"...>
    <routeBuilder resource="path/to/myrouteBuilder.crb"/>
</camelContext>

And crb is just a java source file which will get compiled and then loaded
... ?thoughts
What this means is the crb (camel route builder) can be "seen" by
application support staff, and paths modified and server restarted for
changes etc ..

of course .. goes without saying that I am sure groovy could be plugged in
some how in the same manner (no ? )

thoughts .. am I astronaut thinking ?

r.

Re: XML vs a dynamic DSL

Posted by Roman Kalukiewicz <ro...@gmail.com>.
2009/1/27 Ramon Buckland <ra...@thebuckland.com>:
> Because of the nature of moving paths (and shifting systems from dev to UAT
> and UAT to production) we have found using XML is good for it's flexibile
> change capabilities.
>
> However, I have as usual the XML has pain, that the XML's config becomes
> cumbersome (we have all been there).
>
> I was wondering, has anyone thought of (or is there) a dynamic form of the
> Java DSL .. like .. jsp's or the old jws files in Axis, which are compiled
> on demand.
>
> <camelContext id="camel"...>
>    <routeBuilder resource="path/to/myrouteBuilder.crb"/>
> </camelContext>
>
> And crb is just a java source file which will get compiled and then loaded
> ... ?thoughts
> What this means is the crb (camel route builder) can be "seen" by
> application support staff, and paths modified and server restarted for
> changes etc ..
>
> of course .. goes without saying that I am sure groovy could be plugged in
> some how in the same manner (no ? )

Hello Ramon,

Don't forget, that route builder is a POJO after all, so you can
configure it however you like using spring. Then you just have to
reference your route builder from camel context via <routeBuilderRef/>
element.

Another solution is that you could actively pull your configuration
from Spring/JNDI/... using

getContext().getRegistry().lookup(name);

in your configure() method, so you will configure yourself. This way
you have the best from both worlds - nice tooling and easy notation of
java and flexibility of XML.

Hope it helps

Roman