Reading Time: minute

It has been a while since I last blogged about the new XMPP transport for 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.

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

latest report
Learn why we are the Leaders in management and

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:

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

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:

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

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.