Using Outbound Endpoints to Publish Data
This example shows how to use outbound endpoints in Mule. Outbound endpoints are useful for publishing data to a flow, application, or resource.
How to build on an existing Mule flow in Mule Studio
How to get data from an HTTP inbound endpoint and output it to a file using an outbound endpoint
This example requires that you run through the earlier example Transforming Data in a Flow.
\1. We are going to continue editing the example and add a File component to the flow. Drag the File endpoint from the palette to the canvas after the Echo component.
\2. Double-click on the File endpoint to edit its properties.
\3. In the "General" tab, give your flow a name and choose a path and name for the file that will be outputted. In the example below,
is a Mule expression which automatically appends the current date & time to a file named myfile.
\4. Right-click on the flow in the project tree and select Run As… → Mule Application.
\5. Next, open up a browser and go to http://localhost:8081/echo. You should see the following in your browser:
\6. Now, go back to Mule Studio and check the logs - you will see that myfile#timestamp got created in the specified location with the output inside of it. Browse to the directory in your file explorer and open the file to see your output.
You sent an HTTP request via an inbound endpoint by going to http://localhost:8081/echo.
You added a File endpoint to your flow which demonstrated how Mule can take the information via the HTTP request and output it in different places (in this case, a file).