<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:scripting="http://www.mulesource.org/schema/mule/scripting/2.0"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
       http://www.mulesource.org/schema/mule/scripting/2.0 http://www.mulesource.org/schema/mule/scripting/2.0/mule-scripting.xsd">


    <scripting:script name="scriptText1">
        return "$request.payload $response.payload Received"
    </scripting:script>

    <scripting:script name="scriptText2">
        return "A"
    </scripting:script>

    <scripting:script name="scriptText3">
        return "B"
    </scripting:script>

    <model name="main">

        <service name="GroovyUMO1">
            <inbound>
                <inbound-endpoint address="vm://groovy.1"/>
            </inbound>
            <pooled-component>
                <prototype-object class="org.mule.module.scripting.component.ScriptMessageBuilder">
                    <property key="scriptEngineName" value="groovy"/>
                    <property key="scriptText" value-ref="scriptText1"/>
                </prototype-object>
            </pooled-component>
            <outbound>
                <filtering-router>
                    <outbound-endpoint address="vm://groovy.2"/>
                    <outbound-endpoint address="vm://groovy.3"/>
                </filtering-router>
            </outbound>
        </service>

        <service name="GroovyUMO2">
            <inbound>
                <inbound-endpoint address="vm://groovy.2"/>
            </inbound>
            <pooled-component>
                <prototype-object class="org.mule.module.scripting.component.ScriptComponent">
                    <property key="scriptEngineName" value="groovy"/>
                    <property key="scriptText" value-ref="scriptText2"/>
                </prototype-object>
            </pooled-component>
        </service>

        <service name="GroovyUMO3">
            <inbound>
                <inbound-endpoint address="vm://groovy.3"/>
            </inbound>
            <pooled-component>
                <prototype-object class="org.mule.module.scripting.component.ScriptComponent">
                    <property key="scriptEngineName" value="groovy"/>
                    <property key="scriptText" value-ref="scriptText3"/>
                </prototype-object>
            </pooled-component>
        </service>

    </model>

</mule>
