Aggregation pattern as the name suggest aggregate the data from different system and merge them before processing the response where response can be insertion e.g. Reporting or as Response e.g. HTTP response.
Within Organization you can different system to hold different data e.g. CRM for customer related information, ERP for order processing and shipment and Inventory for holding product information. At any time if I need a report to get all the orders for a particular week.
For this we can have two approaches
First – Get Customers, Orders and Product information to third system say Database and query the Database to get the required information. This has his own overhead where we have to get sync Database with all other systems and then maintaining the Database itself.
Second – we can get the required data from all different system– e.g. get the orders for last week from ERP and then respective Customer and Product information from CRM and Inventory system. Once we have all the data then we can merge the data to provide the required response.
MuleSoft API led approach in Aggregation
Pattern can be realized as per below
- Experience API – To provide the interface to get the aggregate data and this will call process API
- Process API – Will call the respective System API to get the required data. Once it has the required data from all the system then it can aggregate and return as response to experience API
- System APIs – APIs for all different System from where we want to extract the data
Activity to use in MuleSoft application for aggregation – Scatter Gather can be used to call all different System APIs in parallel. More info on Scatter Gather