Posts

Showing posts from 2024

Reduce Anypoint Costs: Use Shared Flows Instead of System APIs

Image
This document talks about how to use Shared Flows in MuleSoft. Usually in an API-led connectivity architecture, we have 3 layers: Experience APIs, Process APIs, and System APIs. This drives business agility for an organization, but at the same time increases costs in Anypoint Platform. Specifically, we are talking about costs associated with the Cloudhub Workers (Number and Size of vCores). A Cloudhub Worker is a dedicated Mule instance where an API runs. So, the number of workers required by an organization is at least equal, if not greater than the number of APIs in the application network. This number quickly gets multiplied by 3 or more, based on the number of Non-Prod and Prod environments. One way of saving these costs is replacing System APIs (at least the simpler ones) with Shared Flows. We create a Mule project with generalized flows and publish that project to Anypoint Exchange as a Mule-Plugin. Then, we include that Mule-Plugin as a dependency in other Mulesoft APIs and re-u...

DLQ Dashboard using React JS & Mulesoft

Image
This document talks about one of my most passionate projects  –  the DLQ Dashboard. In short, it's a user-friendly visualization of SQS FIFO Queues, capable of executing basic operations on queue messages. Its frontend is written in React JS, and the backend is coded in Mulesoft. I've polished it a lot and now it's open-source. Alright, that's enough for the introduction. Without further ado, let us jump right into the demo. I've included English Subtitles too; be sure to enable them if needed. Demo Video Now that you've seen the demo, I believe you have a good understanding of what this project is all about. If you want to take a look under the hood and setup these codes in your local environment, I've added repository URLs below. Repository URLs Frontend: React JS Code Backend:  Mulesoft Code Don't forget to checkout the README.md files of these projects to learn more. Useful I...

Dataweave Code to Sort Nested JSON Objects & Arrays

Image
This document covers Dataweave code to sort nested JSON objects and arrays. For this demonstration, we are using Mulesoft's Online Dataweave Playground - Link as an IDE. Let’s begin... Solution Preview Code Snippet %dw 2.0 fun sortObjectAndArray (inputPayload) = (   if(inputPayload is Object) (     inputPayload mapObject ((value, key, index) ->        (key): sortObjectAndArray (value)     ) orderBy $$   )   else if(inputPayload is Array) (     if(inputPayload[0] is Object)       inputPayload map ((item, index) ->          sortObjectAndArray (item)       )     else       inputPayload orderBy $   )   else inputPayload ) output application/json --- sortObjectAndArray (payload) Brief Explanation This code traverses through a nested JSON Object or Array input and sorts it. Here we have a user-defined function named sortObjectAndArra...