<?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"
       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">

    <model name="ChainingRouterNullsModel">
        <!--
            Both first and last link elements succeed
        -->
        <service name="bridge1">
            <inbound>
                <inbound-endpoint address="vm://incomingPass"/>
            </inbound>

            <outbound>
                <chaining-router>
                    <outbound-endpoint address="vm://component1"/>
                    <outbound-endpoint address="vm://component2Pass"/>
                </chaining-router>
            </outbound>
        </service>

        <!--
            First passes and tags the message, but the last one fails
        -->
        <service name="bridge2">
            <inbound>
                <inbound-endpoint address="vm://incomingLastFail"/>
            </inbound>

            <outbound>
                <chaining-router>
                    <outbound-endpoint address="vm://component1"/>
                    <outbound-endpoint address="vm://component2Fail"/>
                </chaining-router>
            </outbound>
        </service>

        <!--
            First chain component fails, second never fires
        -->
        <service name="bridge3">
            <inbound>
                <inbound-endpoint address="vm://incomingFirstFail"/>
            </inbound>

            <outbound>
                <chaining-router>
                    <outbound-endpoint address="vm://component1Fail"/>
                    <outbound-endpoint address="vm://component2Pass"/>
                </chaining-router>
            </outbound>
        </service>

        <service name="component1">
            <inbound>
                <inbound-endpoint address="vm://component1"/>
            </inbound>
            <pooled-component>
                <prototype-object class="org.mule.tck.functional.FunctionalTestComponent">
                    <property key="appendComponentName" value="true"/>
                </prototype-object>
            </pooled-component>
        </service>

        <service name="component1Fail">
            <inbound>
                <inbound-endpoint address="vm://component1Fail"/>
            </inbound>
            <pooled-component>
                <prototype-object class="org.mule.tck.functional.FunctionalTestComponent">
                    <property key="throwException" value="true"/>
                    <property key="appendComponentName" value="true"/>
                </prototype-object>
            </pooled-component>
        </service>

        <service name="component2Pass">
            <inbound>
                <inbound-endpoint address="vm://component2Pass"/>
            </inbound>
            <pooled-component>
                <prototype-object class="org.mule.tck.functional.FunctionalTestComponent">
                    <property key="appendComponentName" value="true"/>
                </prototype-object>
            </pooled-component>

        </service>

        <service name="component2Fail">
            <inbound>
                <inbound-endpoint address="vm://component2Fail"/>
            </inbound>
            <pooled-component>
                <prototype-object class="org.mule.tck.functional.FunctionalTestComponent">
                    <property key="throwException" value="true"/>
                    <property key="appendComponentName" value="true"/>
                </prototype-object>
            </pooled-component>
        </service>
    </model>
</mule>
