You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

Understanding Mule Interaction with Exchange Patterns

This example explains how Mule interacts with well-known exchange patterns. Exchange patterns provide a set of well-defined interaction patterns between the client and server. In Mule, there are two different types of exchange patterns: one-way and request-response.

What You Will Learn

  • How Mule interacts with exchange patterns

  • The difference between one-way and request-response patterns in Mule

Build It Now!

10 minutes


This example requires that you run through the previous example Using Outbound Endpoints to Publish Data. We are going to use and slightly modify the example to learn about the two different type of exchange patterns.

Building the Example

  1. Double-click on the HTTP endpoint to view its properties, and go to the Advanced tab. Here, you will see that we are currently using the request-response exchange pattern. This means that as we input data into the console, it will also get echo’d out to the browser as well as to the file.


  2. Change the HTTP endpoint to use the one-way exchange pattern as shown below.'


  3. After saving the example, you can see that the diagram has now changed (see below). In the Running the Example, we will see the difference between both of these patterns.


Running the Example

  1. Right-click on the flow in the project tree and select Run As…​ → Mule Application.


  2. Next, open up a browser and go to http://localhost:8081/echo. You should see the following in your browser. Notice that since we switched the exchange pattern to use one-way, the message does not get echo’d back to the console but only to the file.


  3. In order to see what happens with the request-response model, go back to step 2 and change the exchange pattern to be request-response and re-run this example. You will then see the original output from the last example.

What Just Happened?

  • You sent an HTTP request via an inbound endpoint by going to http://localhost:8081/echo.

  • You saw the difference in your application’s behavior between using a one-way exchange pattern and a request-response exchange pattern.