97008 48403
+91 40-27177600


Transmission Control Protocol in Mule ESB


From the technical center of excellence of Massil Technologies, our technology leaders make it easy to understand the complex situations you come across in Mule ESB from the experience of Massil Technologies to have countered them in their experience of working on client projects in real time. This blog talks about Transmission Control Protocol (TCP) in Mule ESB. This blog is a part of series of blogs being authored and published by Massil Technologies for the benefit of the IT community globally.

The TCP transport allows sending or receiving messages over TCP connections. TCP is a layer over IP and used to implement many other reliable protocols such as HTTP and FTP. However, you may want to use the TCP transport directly if you require a specific protocol for reading the message payload that is not supported by one of these higher level protocols. This is often the case when communicating with legacy or native system applications that don’t support web services.

The following Mule transports provide access to TCP connections:

  • The TCP Transport
  • The SSL and TLS Transports which use TCP with socket-level security

Creating a TCP Server:

Step 1:

Drag a TCP connector to the canvas and configure it as shown.


To access the payload we are taking one java component and we are writing one java class for it. Write java code in src/main/java

java code:




publicclassTcpServerimplements Callable {



public Object onCall(MuleEventContexteventContext) throws Exception {

// TODO Auto-generated method stub

User user = (User) eventContext.getMessage().getPayload();

System.out.println(user.getId() + ” ” + user.getFname() + ” ”

+ user.getLname());





Take a Java component from the palette and class name of the java file.


We have to access the server for that takes another flow:

Take one HTTP connector from the palette and configure it like this:

Take JSON-to Object transformer to convert the Payload (JSON payload) write a java code for it.

Java code:



publicclass User implements Serializable {





privatestaticfinallongserialVersionUID = 1L;

privateint id;

private String fname;

private String lname;


publicintgetId() {

return id;



publicvoidsetId(int id) {

this.id = id;



public String getFname() {




publicvoidsetFname(String fname) {

this.fname = fname;



public String getLname() {




publicvoidsetLname(String lname) {

this.lname = lname;




To access the server we have to take TCP connector and configure it as shown:

Let’s test the application and send JSON data.

See the output from the application.

Check whether the server acknowledges the output in the logger.

The above console shows the 5seconds time gap from one processor to another processor. Hence, we have gone through the step by step process to depict the way Massil Technologies team has addressed the scenario mentioned above. Hope this article from Massil Technologies was useful for you. If you have any further queries on this topic, please reach out to info@massil.tech.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Get in touch with us

Scroll to top