The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

JGF1 (322) [Avatar] Offline
#1
I say this, because I've just finished reading Graeme Rocher's Definitive Guide to Grails. Grails is based upon Spring & Hibernate, and used Groovy to create a brilliant DSLs, so much of the mundane XML configuration is abstracted away.
Could someone do the same fore ServiceMix or Mule?
tijs.rademakers (494) [Avatar] Offline
#2
Re: Has anyone thought of applying Groovy to Mule or ServiceMix?
Groovy can be applied to Mule and ServiceMix. You can implement components and transformers and also evaluators with Groovy scripts in Mule. You can even define the whole Mule configuration with a Groovy script instead of using the XML configuration. My opinion is however that the XML configuration is better readable at the moment. For more information see:

http://www.mulesource.org/display/MULE2USER/Scripting+Module

For ServiceMix you can also define your logic with script languages such as Groovy, see:

http://servicemix.apache.org/servicemix-scripting.html

Best regards,

Tijs
JGF1 (322) [Avatar] Offline
#3
Re: Has anyone thought of applying Groovy to Mule or ServiceMix?
Hi Tijs
Have only managed first chapter so far, but potential benefit would be to dynamically alter run time configuration on the fly.
I dare say this may already be catered for as I read on. But its another way to skin a cat!
Cheers for links though.
Jeremy

Have just noticed comment on P104:
Quote:
"ServiceMix is hot deployable
Mule working on OSGi implementation."
Partly answers dynamic alteration capability I eluded to.

Message was edited by:
JGF1
David Dossot (233) [Avatar] Offline
#4
Re: Has anyone thought of applying Groovy to Mule or ServiceMix?
In the same kind of idea, you may want to look at Camel DSL: http://camel.apache.org/scala-dsl.html

Mapping their EIP DSL to Mule or SMX constructs could be a fun project smilie

D.
tijs.rademakers (494) [Avatar] Offline
#5
Re: Has anyone thought of applying Groovy to Mule or ServiceMix?
Hi David,

I didn't take a look at the Scala work in Camel yet, but it looks quite nice. I agree that mapping this kind of construct to Mule or ServiceMix would be great smilie

Best regards,

Tijs
JGF1 (322) [Avatar] Offline
#6
Re: Has anyone thought of applying Groovy to Mule or ServiceMix?
Thanks for tip. Will take a look at this too.
JGF1 (322) [Avatar] Offline
#7
Another good reason to use Groovy.
Looking at Mule Transformers. Currently seems to focus on XSLT. Groovy has great XML parsing capabilities. XMLSlurper etc.
http://groovy.codehaus.org/Reading+XML+using+Groovy's+XmlSlurper
Also all parameters for endpoints can use Hashmaps to represent properties. See Expandos etc. Can the use intelligent defaults : Convention over configuration etc.
David Dossot (233) [Avatar] Offline
#8
Re: Another good reason to use Groovy.
> Looking at Mule Transformers. Currently seems to focus on XSLT.

Not sure I agree with this, there is *a lot* of standard transformers in Mule that are not XML oriented.

Moreover, if you look for advanced messaging transformation, a la ETL, be sure to check the Smooks module for Mule: http://www.mulesource.org/display/SMOOKS/Home

D.
JGF1 (322) [Avatar] Offline
#9
Re: Another good reason to use Groovy.
Hi David.
Thanks again for tips. Will look into SMOOKS.
If Graeme Rocher's Definitive Guide to Grails 2nd edition appears on Google book search, I'll post a link
Until then if you're in a book store, check out his APress book.
Have a peruse of chapter 15 on web services circa P462. Listing 15-18 "Using an XMLBuilder to output XML". Then you'll understand why I think it's a good alternative.
Regards Jeremy
David Dossot (233) [Avatar] Offline
#10
Re: Another good reason to use Groovy.
You can always write custom Mule transformers in Groovy, where you can use XMLBuilder at will.
JGF1 (322) [Avatar] Offline
#11
Re: Another good reason to use Groovy.
Thanks for tip. Another part of jigsaw falls into place. smilie