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

    <vm:connector name="default"/>
    <vm:connector name="queue" queueEvents="true"/>

    <custom-transformer name="rfc822-mime" class="org.mule.transport.email.transformers.Rfc822ByteArraytoMimeMessage"/>
    <custom-transformer name="mime-rfc822" class="org.mule.transport.email.transformers.MimeMessageToRfc822ByteArray"/>

    <model name="main">

        <service name="source">
            <inbound>
                <pop3:inbound-endpoint user="bob" password="secret" host="localhost" port="62002">
                    <transformer ref="mime-rfc822"/>
                </pop3:inbound-endpoint>
            </inbound>
            <outbound>
                <outbound-pass-through-router>
                    <vm:outbound-endpoint connector-ref="default" path="sink"/>
                </outbound-pass-through-router>
            </outbound>
        </service>

        <service name="sink">
            <inbound>
                <vm:inbound-endpoint connector-ref="default" path="sink"/>
            </inbound>
            <outbound>
                <multicasting-router>
                    <vm:outbound-endpoint connector-ref="queue" path="rfc822"/>
                    <smtp:outbound-endpoint user="alice" password="secret" host="localhost" port="62000">
                        <transformer ref="rfc822-mime"/>
                    </smtp:outbound-endpoint>
                </multicasting-router>
            </outbound>
        </service>

    </model>

</mule>
