Back to Blog Archive

Reading a file in the middle of a flow – Mule-requester

Posted on: July 11, 2017


Reading files is one of the most common operations in any application.

While Mule provides a ready and easy to use connector for reading/writing archives in the disk (File Connector), this connector is not suitable for loading the content of a file in the middle of a flow.

To achieve this goal we need to use the mule-module-requester. This module allows the request of different resources at any point in a flow.

The intention of this post is to describe step by step how to install and use the mule module requester.

Installation of the Anypoint Studio Plugin

Download the studio plugin from:

Click here to download it!

To install it, click in “Help” Menu >> “Install New Software”

Click in the button “Add..”, use the option “Archive…” and search for the zip file we just downloaded.

Select “Mule Requester Module” from the list and you are ready to install.

Restart Anypoint Studio.

Set up your project

Be sure that your project is using Maven. In the next step we are going to add the necessary dependencies.

Modify your maven-app-mule-plugin to include the mule-module-requester files:

Add the necessary dependency:

Using mule-requester module

In this example, we are going to use the file connector. If you need to request content from another system, just change the transport prefix, it’s as simple as that.

For example, if you need to read from a JMS Queue, you can do it with jms://input

The first thing that we need to configure is a file-connector config to be used by the mule-module-requester.

Last but not least, we are ready to use it!

Include below code in any flow in which you want to read a file


  • <mulerequester:config/> element is deprecated, no need to add it any more as you may encounter errors adding this element (element not found).
  • It is possible to choose between different connector configs by adding a property; ?connector=<<connector name>>
  • This module allows the use of different transports / endpoints; always read the documentation for the specific transport.
  • It is possible to read multiple elements by switching the operation; <mulerequester:request-collection />
  • Direct link to the mule-module-requester:

5 Comments for “Reading a file in the middle of a flow – Mule-requester”

  1. Manish Yadav says:

    Really Nice Information..

  2. sainath says:

    Thanks for the code, It is working to my scenario but its unable to fetch all files from sftp.
    could you please give me help to pull all files from SFTP.

    • DP says:

      Hi Sainath,
      Any luck or any other alternative you have tried?

    • Mario Martinez says:

      Hello Sainath,

      Notice that the mule-requester provide the option for collecting multiple elements:

      May I know if you tried this approach instead of using the approach ?

  3. John says:

    I am trying to access Anypoint MQ messages with Mule requester, Can anyone help ?


Contact Us

Ricston Ltd.
Triq G.F. Agius De Soldanis,
Birkirkara, BKR 4850,
MT: +356 2133 4457
UK: +44 (0)2071935107

Send our experts a message

Need Help?
Ask our Experts!