Content Filter Pattern for REST Service — Implementation

In the last article, you can find the idea of how to introduce field filtering for your APIs. My simplified Content Filter allows for providing negative or positive filtering. The first one tells which fields Filter removes from the target response. The latter one tells which fields should be available in the response. Today I show you how I have implemented this using DataWeave language.

Filterable DataWeave Module

Okay, our input is straightforward. The Content Filter has two input arguments, like in the diagram below

Dynamically Evaluate Dataweave Scripts

This article demonstrates how to use Dynamic Evaluate Component in Mule 4 to execute dataweave scripts dynamically.

It is a very common use case where a developer may have to execute different dwl scripts (account.dwl/customer.dwl  in this case) depending on the input parameter.

Invoking Stored Procedure With Oracle Abstract Data Type Parameters in Mule 4

This article describes the steps that need to be followed in order to invoke a stored procedure with complex Abstract Data Type as IN, OUT, and IN OUT parameter in Mule 4.

The lack of documentation to handle ADT payloads while invoking stored procedures and technical issues while retrieving the ADT response in mule run time 4.x.x discouraged developers using mulesoft for the purpose.

Filtering Data Using DataWeave in Mule 4 Batch

DataWeave is a MuleSoft expression language for accessing, querying, and transforming data that flows through the Mule application. It is tightly integrated with the Mule runtime engine, which reads the script and expression in our application. It is a powerful template engine that transforms data to and from any kind of format like CSV, JSON, XML, MAP, POJO's, etc.

Dataweave now() function is used to return the current date and time when used inside our application. 

Mule Programming Style Guide: DataWeave Code

In this post, I will discuss how I format my DataWeave code to improve its readability.

In my previous post about my Mule programming style, I discussed a couple of things: first, why the readability of your code is so important, and second, how having a single flow that describes the overall intent of the code through descriptive doc:name attributes can really improve the readability of your code.