<?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:tcp="http://www.mulesource.org/schema/mule/tcp/2.0"
    xmlns:jms="http://www.mulesource.org/schema/mule/jms/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/tcp/2.0 http://www.mulesource.org/schema/mule/tcp/2.0/mule-tcp.xsd
               http://www.mulesource.org/schema/mule/jms/2.0 http://www.mulesource.org/schema/mule/jms/2.0/mule-jms.xsd">

    <tcp:connector name="tcpConnector" keepSendSocketOpen="true">
        <tcp:direct-protocol payloadOnly="true" />
    </tcp:connector>

    <jms:activemq-connector name="jmsConnector" specification="1.1" />

    <jms:jmsmessage-to-object-transformer name="jmsmessage-to-object" />
    <byte-array-to-object-transformer name="bytearray-to-object" />

    <model name="model">

        <service name="TcpReceiver">
            <inbound>
                <!-- Response transformer set here is a workaround because async-reply-router does not apply
                     default inbound jms transformer.  See MULE-2869  -->
                <inbound-endpoint address="tcp://localhost:4444" remoteSync="true" />
            </inbound>
            <component class="org.mule.component.simple.EchoComponent" />
            <outbound>
                <outbound-pass-through-router>
                    <outbound-endpoint address="jms://queue_in" />
                    <reply-to address="jms://queue_out" />
                </outbound-pass-through-router>
            </outbound>
            <async-reply>
                <inbound-endpoint address="jms://queue_out" />
                <single-async-reply-router/>
            </async-reply>
        </service>

        <service name="JMSReplyProvider">
            <inbound>
                <inbound-endpoint address="jms://queue_in">
                    <transformer ref="jmsmessage-to-object" />
                    <transformer ref="bytearray-to-object" />
                </inbound-endpoint>
            </inbound>
            <component>
                <singleton-object class="org.mule.tck.testmodels.services.TestReceiver" />
            </component>
        </service>
    </model>

</mule>
