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

Validation Component In Mule 4

 

Test the project from soapui

Validation Component In Mule 4

 

Sample application: validationmodule sample application

Sample Soapui project: ValidateComponent-soapui-project

 

  
Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
 
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.


Share this:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments