From 2057ac2bd51a00bcc0ee5e620f7867ad852172bd Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 2 Sep 2010 13:20:37 +0000 Subject: [PATCH] INT-1392 added groovy docs --- src/docbkx/groovy.xml | 73 +++++++++++++++++++++++++++++++++++++++++++ src/docbkx/index.xml | 1 + 2 files changed, 74 insertions(+) create mode 100644 src/docbkx/groovy.xml diff --git a/src/docbkx/groovy.xml b/src/docbkx/groovy.xml new file mode 100644 index 0000000000..1ee695ff97 --- /dev/null +++ b/src/docbkx/groovy.xml @@ -0,0 +1,73 @@ + + + + Groovy support + + With Spring Integration 2.0 we've added Groovy support allowing you to use Groovy scripting language to provide + integration and business logic  for various integration components similar to the way Spring Expression Language (SpEL) + is use to implement routing, transformation and other integration concerns. + + For more information about Groovy please refer to Groovy documentation which you can find here: http://groovy.codehaus.org/ + + +
+ Groovy configuration + + Depending on the complexity of your integration requirements Groovy scripts could be provided inline as CDATA in XML + configuration or as a reference to a file containing Groovy script. + + To enable Groovy support Spring Integration defines GroovyScriptExecutingMessageProcessor which will + create a groovy Binding object identifying Message Payload as payload variable and Message Headers as + headers variable. All that is left for you to do is write script that uses these variables. + Below are couple of sample configurations: + + + + Filter + <filter input-channel="referencedScriptInput"> + <groovy:script location="some/path/to/groovy/file/GroovyFilterTests.groovy"/> +</filter> + +<filter input-channel="inlineScriptInput"> + <groovy:script><![CDATA[ + return payload == 'good' + ]]></groovy:script> +</filter> +You see that script could be included inline or via location attribute using the groovy namespace sport.  + + + + Other supported elements are router, service-activator, transformer, splitter + + + + Another interesting aspect of using Groovy support is framework's ability to update (reload) scripts  + without restarting the Application Context. + To accomplish this all you need is specify refresh-check-delay attribute on script + element. The reason for this attribute is to make reloading of the script more efficient.  + + ]]> + + In the above example for the next 5 seconds after you update the script you'll still be using the old script and + after 5 seconds the context will be updated with the new script. This is a good example where  'near real time' + is acceptable. + + ]]> + + In the above example the context will be updated with the new script every time the script is modified. Basically this is the example of the + 'real-time' and might not be the most efficient way. + + ]]> + + + Any negative number value means the script will never be refreshed after initial initialization of application context. + DEFAULT BEHAVIOR + + Inline defined script can not be reloaded. + + + +
+ +
\ No newline at end of file diff --git a/src/docbkx/index.xml b/src/docbkx/index.xml index 227321f3a2..f7f75ad075 100644 --- a/src/docbkx/index.xml +++ b/src/docbkx/index.xml @@ -88,6 +88,7 @@ +