Translate

Monday 6 November 2023

Which flow(s) can be called using lookup function Mulesoft

Which flow(s) can be called using lookup function 

The lookup function in MuleSoft can be used to call any private flow in your Mule application.

https://youtu.be/7FQCzJEJobM

To call a private flow using the lookup function, you need to specify the name of the private flow as the first argument to the lookup function. You can also pass additional arguments to the private flow by specifying them as subsequent arguments to the lookup function.

For example, the following code snippet shows how to call a private flow named myPrivateFlow using the lookup function:

 

lookup("myPrivateFlow", payload)


This code will call the private flow myPrivateFlow and pass the current message payload to the private flow as an argument.

You can also use the lookup function to call a private flow that is defined in another Mule application. To do this, you need to specify the name of the Mule application containing the private flow as the first argument to the lookup function, followed by the name of the private flow as the second argument.

For example, the following code snippet shows how to call a private flow named myPrivateFlow that is defined in a Mule application named myMuleApplication using the lookup function:

 

lookup("myMuleApplication:myPrivateFlow", payload)


This code will call the private flow myPrivateFlow that is defined in the Mule application myMuleApplication and pass the current message payload to the private flow as an argument.

The lookup function is a powerful tool that can be used to reuse code and to make your Mule applications more modular and maintainable.