caef951 Dec 11, 2012
33 lines (27 sloc) 1.4 KB
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-groovy="http://www.springframework.org/schema/integration/groovy"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/groovy http://www.springframework.org/schema/integration/groovy/spring-integration-groovy.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- This implements the core business logic of the integration flow. Not
binding input and output channels to JMS (or any other protocol) within makes
this flow more easily testable. -->
<!-- Throw an exception -->
<int:transformer input-channel="inputChannel"
output-channel="outputChannel">
<int-groovy:script><![CDATA[
if (!payload.equals('hello')) {
throw new RuntimeException('invalid payload')
}
payload
]]>
</int-groovy:script>
</int:transformer>
<int:channel id="outputChannel" />
<!-- Do some error handling -->
<int:transformer input-channel="errorChannel"
output-channel="invalidMessageChannel" expression="payload.cause.cause.message" />
<int:channel id="invalidMessageChannel" />
</beans>