Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<route>
  <from uri="file://inbox"/>
  <script>
    <groovy><![CDATA[ some groovy script here that can be multiple lines and whatnot ]]></groovy>
  </script>
  <beanRef ref="myServiceBean" method="processLine"/>
</route>

<bean id="myServiceBean" class="com.mycompany.MyServiceBean"/>

Using external script files

You can refer to external script files instead of inlining the script. For example to load a groovy script from the classpath you need to prefix the value with resources: as shown:

Code Block
xml
xml
<route>
  <from uri="file://inbox"/>
  <script>
    <groovy>resources:classpath:com/foo/myscript.groovy</groovy>
  </script>
  <beanRef ref="myServiceBean" method="processLine"/>
</route>

<bean id="myServiceBean" class="com.mycompany.MyServiceBean"/>

You can also refer to the script from the file system with file: instead of classpath: such as file:/var/myscript.groovy

 

Include Page
Using This Pattern
Using This Pattern