[jboss-dev-forums] [Design of JBoss ESB] - Groovy Scripted Gateways... Useful for testing... and more p

tfennelly do-not-reply at jboss.com
Thu Apr 19 14:59:12 EDT 2007


I was playing around with some Groovy scripts for doing some Groovy SOAP using the GroovyActionProcessor.

I got fed up redeploying .esbs and restarting the AS, so I wanted a way of updating the Groovy script run by the GroovyActionProcessor without redeploying or restarting.

The answer was a new gateway which can run Groovy scripts. Effectively, the Groovy script becomes the gateway.  With this I was able write a really simple Groovy Scripted Gateway that popped up a Swing form through which I could deliver a message payload to the target service - in this case, a Groovy script.  So I now had a convenient way of modifying the script, on the fly, with no need for redeploys or restarts.  Useful for testing.  See the flash.

So the esb config for running this Gateway Script (bundled in the product) is as follows (listeners and actions only):

  | <listeners>
  |     <groovy-listener name="soap-client" script="MessageInjectionConsole" is-gateway="true" />
  |     <jms-listener name="JMS-Helper-ESBListener" busidref="GroovyService"/>
  | </listeners>
  | <actions>
  |     <action name="groovy" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor" />
  | </actions>
  | 

Note the groovy-listener listener element.

This particular Groovy Gateway script is here.  Note how simple it is.  It uses a UncomposedMessageDeliveryAdapter instance (available to all Gateway sctips) to deliver the message to the target service, async or sync.

You could write Groovy scripted Gateways to do all sorts of other stuff too e.g. Groovy and XFire are tightly integrated => you could stand up an XFire Gateway in a few lines of code (in theory - according to the Groovy website).

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038994#4038994

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038994



More information about the jboss-dev-forums mailing list