what are anypoint validations with mulesoft
TRANSCRIPT
What are Anypoint Validations With Mulesoft
Anypoint ValidationValidations is out-of-box feature available with Mulesoft to verify the content of message in the Mule flow like validating the date format, email address, url, IP etc. The advantage of validations over the filters is traceability. Filter raised the all identical exceptions which is difficult to understand where the exceptions was raised where as validations provide exceptions with some meaningful message and its easy to understand.
• If message doesn't meets a specified criteria, the validation fails and ValidationException will be raised.
• Exception raised have a meaningful message attached. You can optionally customize the message as well as exception raised.
• There is facility to build your own custom validator if out-of-box validations doesn't match your requirements.
Validator can be used as Message Processor as well as MEL (Mule Expression Language).
Anypoint ValidationValidate Email Address
It is used to check the email address is valid or not. e.g. [email protected]
Anypoint ValidationValidate URL
It is used to check the url is valid or not. e.g. http://www.dzone.com
Anypoint ValidationValidate Regular Expression
It is used to check the content of message on defined pattern. e.g. ^[1-9]\d*$
Anypoint ValidationValidate Size
It is used validate the input message size between min and max boundaries. It's valid for inputs like Map, Array, String and Collections.
Anypoint ValidationValidate IP
It is used to check the IP is valid or not. e.g. 10.10.131.122
Anypoint ValidationValidate String, Collection or Map Is Not Empty
In case of String, the definition of not empty is if length of input data is greater than zero and in case of Map and Collection, the definition of not empty, it refers how many items it contains.
Anypoint ValidationIs True and Is False Fallback Validators
You have seen many validations above and sometime there might be scenario which cannot be meet from above validations. So you can use two fallback validators, to evaluate the expression is True or is False.
Anypoint ValidationValidating Multiple Conditions at Once
There may be scenario where you need to validate the several conditions. If more than one condition fails, it is ideal to generate a single error with all the description.
• Validators are executed sequentially in flow's thread.
• All validations are executed, even all validations fails.
• Unlike the rest of the validators, the all validator does not allow you to directly customize the exception type or the message through validation
• If any of the validators fails, only single error will be thrown.
Thank You