Search code examples
muleesbmule-studiomule-flow

Mule 3.5.0 - How to run flows in sequence


I have two flows in my Mule application that I wish to run in sequence in order to try and achieve the following:

  1. First flow reads information from a file and creates rows in a database
  2. Second flow reads information from a different file and updates rows in the same database

Both files are dropped in the same location at the same time. Is there a simple way in Mule I can restrict the second flow from running until the first has completed? I'm very new to Mule so please excuse the potentially novice question! Thanks in advance.


Solution

    • Use a filter on the file inbound endpoint of the first flow so it picks only the file intended for itself, not the files for the second flow.
    • At the end of the first flow, flow-ref the second flow.
    • Make sure the first flow executes synchronously otherwise the JDBC operation in it may happen after the call to the second flow.
    • In the second flow, use the requester module to retrieve the second file.
    • Process it...