Reading Time: 3 minutes

It has been a while since I last blogged about the new XMPP transport for Mule ESB. I’ve been making slow progress since then, but I’ve finally arrived at a point where the transport is starting to be useable. I’d like to show that by building a simple jabber client using the XMPP and stdio transports.

Before I can even start sending something I need to connect to a Jabber server. All server information is configured on the connector element.


<xmpp:<a href="https://www.mulesoft.com/exchange#!/?types=connector" target="_blank" rel="" title="Cloud Connectors" >connector</a> name="xmppConnector" host="localhost" 
    user="dirk" password="secret"/>

Now, let’s send out a message to a chat partner. The input is read from the console so I can interactively play with the transport:


<service name="stdio2xmpp">
    <inbound>
        <stdio:inbound-endpoint system="IN"/>
    </inbound>
    <outbound>
        <pass-through-router>
            <xmpp:outbound-endpoint recipient="mule@localhost" type="CHAT"/>
        </pass-through-router>
    </outbound>
</service>

Now when I type something on the console and press return, a message is created, flows through Mule, and the XMPP transport forwards it to the Jabber server.

Chatting is typically a two way communication so I need a second flow to receive my chat partner’s replies:


<service name="xmpp2stdio">
    <inbound>
        <xmpp:inbound-endpoint type="CHAT" from="mule@localhost" 
            transformer-refs="xmpp2object"/>
    </inbound>
    <outbound>
        <pass-through-router>
            <stdio:outbound-endpoint system="OUT"/>
        </pass-through-router>
    </outbound>
</service>

The xmpp-to-object-transformer (referenced as xmpp2object above) is necessary to extract the payload from the xmpp message that’s received from the Jabber server into a plain String that is displayed on the console.

Did I whet your appetite? You can play with the new transport yourself. Snapshot builds are available from our continuous integration server. I’d be very interested in any feedback you have.