Creating and Using Key-Value Lookups in MuleSoft (Mule 4)
Lookups or key-value pairs are really helpful while developing integrations. Suppose, we get a value from the source system but the target system requires a corresponding value for that key(incoming data). One way is to store such cross-reference in a database table and fetch values. What if, these values are not changed frequently, and accessing a database will probably pose an overhead. A better approach would be to have a static lookup file included within the Mule application. This lookup file can be a .csv, JSON, XML, Excel, etc. file. For simplicity, in this blog, we will be using CSV files as an example for creating and using lookups in Mule 4. A CSV file is easy to maintain and use. Let's start with the below use case. Let's take a use case of Country codes. From the source system, the country field contains Country Name e.g. India but our target system requires 2 character Country Code e.g. IN as input in one of the fields. Now ...