Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+

Dynamic Connections

Dynamic Connections

Many integrations require connecting to different servers depending on a certain condition. Examples of this include:

  • Connecting to different invoice storage servers depending on the branch that emitted the invoice.

  • Connecting to different servers depending on a given integration subject, like in a multi-tenant use case.

To accommodate these use cases, the config element supports expressions, which make it possible for connection parameters to evaluate these conditions and connect to the correct server.

The next examples shows a dynamic multicast app that:

1 Defines a config for the connector in which the host, username, and password are expressions.
2 Describes a flow in which content is posted through HTTP.
3 Uses the File connector to read a CSV file that contains a random set of SFTP destinations with columns such as host, user, and port.
4 Uses a <foreach> component to iterate over each of the lines in the CSV file.
5 On each <foreach> iteration, resolves each expression in the connector config to a different value, establishing different connections to each of the servers.

In this topic: