Reading Time: 2 minutes

Right now TCP inbound endpoints are implemented as TCP servers that listen for coming from different clients. In 2.2.6 we are adding a new feature to inverse the control: TCP inbounds can now poll data from remote servers.

It is really easy to switch to this strategy. Let’s take a look of how a mule configuration looks like:

<!--?xml version="1.0" encoding="UTF-8"?-->
<mule xmlns:xsi="" xmlns:tcp="" xmlns:vm="" xsi:schemalocation="

    <vm:connector name="queue" queueevents="true">

    <tcp:polling-connector name="pollingConnector" clientsotimeout="3000" pollingfrequency="1000">
        <tcp:direct-protocol payloadonly="true">

    <model name="echoModel">
        <service name="echo">
                <tcp:inbound-endpoint host="localhost" port="4444">
                    <vm:outbound-endpoint path="out" connector-ref="queue">
latest report
Learn why we are the Leaders in API management and iPaaS

Notice the new tcp:polling-connector element in the mule configuration file. This element tells mule to poll with a frequency of 1000ms and a timeout of 3000ms.
Using the above configuration we can create a TCP server that writes messages like this:

String stringMessage = "the message";
ServerSocket serverSocket = new ServerSocket(4444);
Socket clientSocket = serverSocket.accept();
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);

You can check the value received in the out outbound using the MuleClient like this:

MuleClient client = new MuleClient();
MuleMessage message = client.request("vm://out?connector=queue", 10000);
String receivedMessage = message.getPayloadAsString();

The receivedMessage variable will hold the received value from the TCP Server.

If you want to try it, please download 2.2.6 or the latest 3.0 milestone