Validation Component In Mule 4
Validation Component In Mule 4 can verify that the contents of a message in a Mule flow match specific criteria. If a message does not meet the specific criteria validation failed and returns a validation error. Based on the data you can customize the error message
Available validation operation in Mule 4:
I will create one sample project to validate the data and configure the customized error message
Create a sample project in anypoint studio and configure the listener
Sample Input:
{ "status": "failure", "data": [ { "id": "1", "employee_name": "", "employee_salary": 320800, "employee_age": 61, "profile_image": "" } ] }
Drag and drop Is Not Null Validation component from mule palette to validate the employee name
configure validation component with error message and expression to check the employee name
Deploy and test the application in debug mode
In case the validation component failed error will be raised and it will be part of the mule error object as shown below
Test the project from soapui
Sample application: validationmodule sample application
Sample Soapui project: ValidateComponent-soapui-project