SlideShare a Scribd company logo
1 of 10
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
www.whishworks.comwww.whishworks.com
Mule ESB- Data Validation- Best
Practices
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
Overview
• Validation of data in ESB application at different layers of message
processing is a requirement which is quite frequent.
• Often, the validation logic is implemented at different layers which
is time consuming and also prone to errors.
• Therefore, it is necessary to separate domain model and the
validation logic, further to it, it also has to be aimed for reuse with
the help of framework.
• This presentation focuses to bring the goodness of JSR303 Bean
Validation model [Hibernate RI], Spring framework’s support for
custom validation and a blend on how it will work in MuleSoft ESB.
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
Deploying Mule Applications
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
Validation Requirements
• From an ESB point of view, the validation requirements are:
• Provide uniform approach to validate different type of payloads
supporting REST, SOAP, XML, Java VO and other types of payloads
• Provide support for field level validations (example: validate
inbound message attributes)
• Provide support for custom validations (based on business logic)
• Support context specific messages for validation errors from
configuration files
• Raise validation errors for handling alternate flow of execution
• Inject validators as pluggable components in flow
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
Mule offerings and shortcomings
• Mule supports validations to an extent but that is not
sufficient; for example
• The validator pattern from Mule supports validation using
MEL which is barely sufficient; forcing to write MEL for every
attribute and has no option to wire to an error code/message
• The JSON validator checks whether the input JSON is
formatted. It does not support features to apply a constraint
like checking the length of an attribute, for null value or for an
empty string, etc.
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
Benefits of JSR303 specification
• Java Bean Validation (JSR303) is a framework as part of Java EE.
• The bean validation defines meta model and API for data validation.
• The implementation is done through annotations and is extensible, which
can be reused by simply adding annotations to the domain model.
// Example – define constraints to a bean
public class Person {
@NotNull (message=’ERR-BS-001’)
public class Person{
@NotNull (message=’ERR-BS-001’)
@Size(min=1, max=16)
private String firstName;
@NotNull (message=’ERR-BS-002’)
@Size(min=1, max=16)
private String lastName;
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
• Spring framework supports JSR303 bean validations and support for
custom validation. Some of the advantages upon using Spring
Validators are mentioned below:
• Spring framework is a natural choice of Mule for DI – No additional
set-up is required
• Custom Spring Validators can be injected to a Mule ESB flow so as
to validate business logic
• Supports JSR 303 validation by making use of a reference
implementation like Hibernate Validator API or Apache BVal API
• Link validation errors using Spring property placeholders for error
messages which are context specific
7
Benefits of Spring Validators
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
A validation framework is necessary, which binds annotation
validators, custom validators and error message handler.
8
Blending all together
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
• To validate annotations, JSR303 RI is required in the
library. Hibernate Validator or Apache’s BVal can be used to
support annotation based validations.
• To validate concrete domain models, Spring framework’s
ValidationUtils class should be used (from
springframework.validation package). The ValidationUtil’s method
should invoke a custom validator thus providing FieldErrors.
• The ExceptionFactory consolidates the FieldErrors from different
validators, fetches the attribute name and message ID and loads the
message from the message source.
• Custom validators to the ValidationUtils should be injected as
Spring beans in Mule.
• Exception factory should use Spring’s PropertiesFactoryBean to load
error messages at runtime.
9
Cont..
2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential
• It might be possible to use annotations in order to validate REST
requests by using @Valid annotation.
• Mule ESB 6.1 has upgraded Jersey version 2.11 (RI) which supports
validation using @Valid annotation prior to a REST method
invocation (like in Spring MVC).
// update user profile after validation
@POST
@Consumes( MediaType.APPLICATION_JSON_VALUE )
public boolean updateProfile(
@Valid UserProfile mProfile )
//…
}
10
Go for the extra mile!

More Related Content

What's hot

How Secure is Your API?
How Secure is Your API?How Secure is Your API?
How Secure is Your API?Mary Joy Sabal
 
Mule soft mcia-level-1 Dumps
Mule soft mcia-level-1 DumpsMule soft mcia-level-1 Dumps
Mule soft mcia-level-1 DumpsArmstrongsmith
 
First Caracas MuleSoft Meetup Slides
First Caracas MuleSoft Meetup SlidesFirst Caracas MuleSoft Meetup Slides
First Caracas MuleSoft Meetup SlidesFernando Silva
 
MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019Ieva Navickaite
 
MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...
MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...
MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...Jitendra Bafna
 
Learn mulesoft from scratch
Learn mulesoft from scratchLearn mulesoft from scratch
Learn mulesoft from scratchNikhil More
 
Second Caracas MuleSoft Meetup Slides
Second Caracas MuleSoft Meetup SlidesSecond Caracas MuleSoft Meetup Slides
Second Caracas MuleSoft Meetup SlidesFernando Silva
 
NYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile Applications
NYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile ApplicationsNYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile Applications
NYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile ApplicationsGean Martinez
 
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...Jitendra Bafna
 
Nashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load Balancer
Nashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load BalancerNashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load Balancer
Nashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load BalancerJitendra Bafna
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...Jitendra Bafna
 
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...Jitendra Bafna
 
MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...
MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...
MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...Jitendra Bafna
 
Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft
Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft
Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft NaimishKakkad2
 
TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for MicroservicesVMware Tanzu
 
Caching strategies in MuleSoft
Caching strategies in MuleSoftCaching strategies in MuleSoft
Caching strategies in MuleSoftNeerajKumar1965
 
MuleSoft certified platform architect-level 1 Real Exam Questions
MuleSoft certified platform architect-level 1 Real Exam QuestionsMuleSoft certified platform architect-level 1 Real Exam Questions
MuleSoft certified platform architect-level 1 Real Exam Questionsdouglascarnicelli
 

What's hot (20)

How Secure is Your API?
How Secure is Your API?How Secure is Your API?
How Secure is Your API?
 
Mule soft mcia-level-1 Dumps
Mule soft mcia-level-1 DumpsMule soft mcia-level-1 Dumps
Mule soft mcia-level-1 Dumps
 
First Caracas MuleSoft Meetup Slides
First Caracas MuleSoft Meetup SlidesFirst Caracas MuleSoft Meetup Slides
First Caracas MuleSoft Meetup Slides
 
MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019
 
MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...
MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...
MuleSoft Surat Virtual Meetup#36 - MuleSoft Composer for Salesforce - No Code...
 
Learn mulesoft from scratch
Learn mulesoft from scratchLearn mulesoft from scratch
Learn mulesoft from scratch
 
Second Caracas MuleSoft Meetup Slides
Second Caracas MuleSoft Meetup SlidesSecond Caracas MuleSoft Meetup Slides
Second Caracas MuleSoft Meetup Slides
 
CICD Mule
CICD Mule CICD Mule
CICD Mule
 
NYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile Applications
NYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile ApplicationsNYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile Applications
NYC MuleSoft Meetup 2019 Q2- MuleSoft for Mobile Applications
 
Meetup bangalore-may22nd2021
Meetup bangalore-may22nd2021Meetup bangalore-may22nd2021
Meetup bangalore-may22nd2021
 
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
MuleSoft Surat Virtual Meetup#15 - Caching Scope, Caching Strategy and Jenkin...
 
Nashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load Balancer
Nashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load BalancerNashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load Balancer
Nashik MuleSoft Virtual Meetup#1 - Shared and Dedicated Load Balancer
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
 
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
 
WHISHWORKS-MuleSoft Hyderabad Meetup -Oct 2018
WHISHWORKS-MuleSoft Hyderabad Meetup -Oct 2018WHISHWORKS-MuleSoft Hyderabad Meetup -Oct 2018
WHISHWORKS-MuleSoft Hyderabad Meetup -Oct 2018
 
MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...
MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...
MuleSoft Surat Virtual Meetup#24 - MuleSoft and Salesforce Integration and De...
 
Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft
Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft
Nagpur MuleSoft Meetup Group - Working with API Groups in Mulesoft
 
TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for Microservices
 
Caching strategies in MuleSoft
Caching strategies in MuleSoftCaching strategies in MuleSoft
Caching strategies in MuleSoft
 
MuleSoft certified platform architect-level 1 Real Exam Questions
MuleSoft certified platform architect-level 1 Real Exam QuestionsMuleSoft certified platform architect-level 1 Real Exam Questions
MuleSoft certified platform architect-level 1 Real Exam Questions
 

Viewers also liked

Viewers also liked (7)

Nathan m ebola
Nathan m ebolaNathan m ebola
Nathan m ebola
 
Ebola virus disease
Ebola virus diseaseEbola virus disease
Ebola virus disease
 
Ebola, ethical issues
Ebola, ethical issuesEbola, ethical issues
Ebola, ethical issues
 
Ebola ppt
Ebola pptEbola ppt
Ebola ppt
 
Ebola ppt
Ebola pptEbola ppt
Ebola ppt
 
Ebola ppt
Ebola pptEbola ppt
Ebola ppt
 
Ebola presentation
Ebola presentationEbola presentation
Ebola presentation
 

Similar to Mule ESB- Data Validation- Best Practices

Mule soft esb – data validation best practices
Mule soft esb – data validation best practicesMule soft esb – data validation best practices
Mule soft esb – data validation best practicesalfa
 
.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric.NET microservices with Azure Service Fabric
.NET microservices with Azure Service FabricDavide Benvegnù
 
Global Azure Bootcamp: Azure service fabric
Global Azure Bootcamp: Azure service fabric Global Azure Bootcamp: Azure service fabric
Global Azure Bootcamp: Azure service fabric Luis Valencia
 
Refactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationRefactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationStephen Fuqua
 
Take Your Web Development To The Next Level With These Top 2 Libraries
Take Your Web Development To The Next Level With These Top 2 LibrariesTake Your Web Development To The Next Level With These Top 2 Libraries
Take Your Web Development To The Next Level With These Top 2 LibrariesPolyxer Systems
 
Microsoft ALM Support - Testing Perspective
Microsoft ALM Support - Testing PerspectiveMicrosoft ALM Support - Testing Perspective
Microsoft ALM Support - Testing PerspectiveDeepu S Nath
 
NIC - Windows Azure Pack - Level 300
NIC - Windows Azure Pack - Level 300NIC - Windows Azure Pack - Level 300
NIC - Windows Azure Pack - Level 300Kristian Nese
 
New ThousandEyes Product Features and Release Highlights: March 2024
New ThousandEyes Product Features and Release Highlights: March 2024New ThousandEyes Product Features and Release Highlights: March 2024
New ThousandEyes Product Features and Release Highlights: March 2024ThousandEyes
 
Zure Azure PaaS Zero to Hero - DevOps training day
Zure Azure PaaS Zero to Hero - DevOps training dayZure Azure PaaS Zero to Hero - DevOps training day
Zure Azure PaaS Zero to Hero - DevOps training dayOkko Oulasvirta
 
Azure service fabric overview
Azure service fabric overviewAzure service fabric overview
Azure service fabric overviewBaskar rao Dsn
 
A project on spring framework by rohit malav
A project on spring framework by rohit malavA project on spring framework by rohit malav
A project on spring framework by rohit malavRohit malav
 
Automated DevOps Workflows with Chef on AWS
Automated DevOps Workflows with Chef on AWSAutomated DevOps Workflows with Chef on AWS
Automated DevOps Workflows with Chef on AWSAmazon Web Services
 
Barracuda, AWS & Securosis: Application Security for the Cloud
Barracuda, AWS & Securosis:  Application Security for the CloudBarracuda, AWS & Securosis:  Application Security for the Cloud
Barracuda, AWS & Securosis: Application Security for the CloudAmazon Web Services
 
NServiceBus Mule ESB Comparison
NServiceBus Mule ESB ComparisonNServiceBus Mule ESB Comparison
NServiceBus Mule ESB ComparisonMike Byrne
 
Securing Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOpsSecuring Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOpsAmazon Web Services
 
Validation for APIs in Laravel 4
Validation for APIs in Laravel 4Validation for APIs in Laravel 4
Validation for APIs in Laravel 4Kirk Bushell
 
DevOps and Automation for Bioinformaticians
DevOps and Automation for BioinformaticiansDevOps and Automation for Bioinformaticians
DevOps and Automation for BioinformaticiansSimon Twigger
 

Similar to Mule ESB- Data Validation- Best Practices (20)

Mule soft esb – data validation best practices
Mule soft esb – data validation best practicesMule soft esb – data validation best practices
Mule soft esb – data validation best practices
 
.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric
 
Global Azure Bootcamp: Azure service fabric
Global Azure Bootcamp: Azure service fabric Global Azure Bootcamp: Azure service fabric
Global Azure Bootcamp: Azure service fabric
 
Refactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test AutomationRefactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test Automation
 
Take Your Web Development To The Next Level With These Top 2 Libraries
Take Your Web Development To The Next Level With These Top 2 LibrariesTake Your Web Development To The Next Level With These Top 2 Libraries
Take Your Web Development To The Next Level With These Top 2 Libraries
 
Microsoft ALM Support - Testing Perspective
Microsoft ALM Support - Testing PerspectiveMicrosoft ALM Support - Testing Perspective
Microsoft ALM Support - Testing Perspective
 
NIC - Windows Azure Pack - Level 300
NIC - Windows Azure Pack - Level 300NIC - Windows Azure Pack - Level 300
NIC - Windows Azure Pack - Level 300
 
New ThousandEyes Product Features and Release Highlights: March 2024
New ThousandEyes Product Features and Release Highlights: March 2024New ThousandEyes Product Features and Release Highlights: March 2024
New ThousandEyes Product Features and Release Highlights: March 2024
 
Zure Azure PaaS Zero to Hero - DevOps training day
Zure Azure PaaS Zero to Hero - DevOps training dayZure Azure PaaS Zero to Hero - DevOps training day
Zure Azure PaaS Zero to Hero - DevOps training day
 
Azure service fabric overview
Azure service fabric overviewAzure service fabric overview
Azure service fabric overview
 
A project on spring framework by rohit malav
A project on spring framework by rohit malavA project on spring framework by rohit malav
A project on spring framework by rohit malav
 
Fluent validation
Fluent validationFluent validation
Fluent validation
 
Automated DevOps Workflows with Chef on AWS
Automated DevOps Workflows with Chef on AWSAutomated DevOps Workflows with Chef on AWS
Automated DevOps Workflows with Chef on AWS
 
Azure service fabric
Azure service fabricAzure service fabric
Azure service fabric
 
Barracuda, AWS & Securosis: Application Security for the Cloud
Barracuda, AWS & Securosis:  Application Security for the CloudBarracuda, AWS & Securosis:  Application Security for the Cloud
Barracuda, AWS & Securosis: Application Security for the Cloud
 
NServiceBus Mule ESB Comparison
NServiceBus Mule ESB ComparisonNServiceBus Mule ESB Comparison
NServiceBus Mule ESB Comparison
 
Securing Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOpsSecuring Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOps
 
Validation for APIs in Laravel 4
Validation for APIs in Laravel 4Validation for APIs in Laravel 4
Validation for APIs in Laravel 4
 
DevOps and Automation for Bioinformaticians
DevOps and Automation for BioinformaticiansDevOps and Automation for Bioinformaticians
DevOps and Automation for Bioinformaticians
 
05 test infrastructure
05   test infrastructure05   test infrastructure
05 test infrastructure
 

More from Coforge (Erstwhile WHISHWORKS)

Performing a successful technical debt assessment in Salesforce
Performing a successful technical debt assessment in SalesforcePerforming a successful technical debt assessment in Salesforce
Performing a successful technical debt assessment in SalesforceCoforge (Erstwhile WHISHWORKS)
 
10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migration10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migrationCoforge (Erstwhile WHISHWORKS)
 

More from Coforge (Erstwhile WHISHWORKS) (15)

Implementing your APIs with zero trust
Implementing your APIs with zero trustImplementing your APIs with zero trust
Implementing your APIs with zero trust
 
Performing a successful technical debt assessment in Salesforce
Performing a successful technical debt assessment in SalesforcePerforming a successful technical debt assessment in Salesforce
Performing a successful technical debt assessment in Salesforce
 
Kafka in banking infographic
Kafka in banking infographicKafka in banking infographic
Kafka in banking infographic
 
The use of data in 2020 and beyond
The use of data in 2020 and beyondThe use of data in 2020 and beyond
The use of data in 2020 and beyond
 
10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migration10 things to consider when planning your Mule 4 migration
10 things to consider when planning your Mule 4 migration
 
WHISHWORKS-MuleSoft Hyderabad Meetup -April 2019
WHISHWORKS-MuleSoft Hyderabad Meetup -April 2019WHISHWORKS-MuleSoft Hyderabad Meetup -April 2019
WHISHWORKS-MuleSoft Hyderabad Meetup -April 2019
 
7 steps to Predictive Analytics
7 steps to Predictive Analytics 7 steps to Predictive Analytics
7 steps to Predictive Analytics
 
Big Data into the MuleSoft world
Big Data into the MuleSoft worldBig Data into the MuleSoft world
Big Data into the MuleSoft world
 
Integration Snapshot 2018/2019
Integration Snapshot 2018/2019Integration Snapshot 2018/2019
Integration Snapshot 2018/2019
 
Big Data Snapshot - June 2018
Big Data Snapshot - June 2018Big Data Snapshot - June 2018
Big Data Snapshot - June 2018
 
SUEZ Business Transformation Journey
SUEZ Business Transformation JourneySUEZ Business Transformation Journey
SUEZ Business Transformation Journey
 
Telecom Service Integration
Telecom Service IntegrationTelecom Service Integration
Telecom Service Integration
 
Microservices with Mule
Microservices with MuleMicroservices with Mule
Microservices with Mule
 
Message oriented middleware
Message oriented middlewareMessage oriented middleware
Message oriented middleware
 
Best way to Deploy a Mule ESB Application
Best way to Deploy a Mule ESB ApplicationBest way to Deploy a Mule ESB Application
Best way to Deploy a Mule ESB Application
 

Recently uploaded

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 

Recently uploaded (20)

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Mule ESB- Data Validation- Best Practices

  • 1. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential www.whishworks.comwww.whishworks.com Mule ESB- Data Validation- Best Practices
  • 2. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential Overview • Validation of data in ESB application at different layers of message processing is a requirement which is quite frequent. • Often, the validation logic is implemented at different layers which is time consuming and also prone to errors. • Therefore, it is necessary to separate domain model and the validation logic, further to it, it also has to be aimed for reuse with the help of framework. • This presentation focuses to bring the goodness of JSR303 Bean Validation model [Hibernate RI], Spring framework’s support for custom validation and a blend on how it will work in MuleSoft ESB.
  • 3. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential Deploying Mule Applications
  • 4. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential Validation Requirements • From an ESB point of view, the validation requirements are: • Provide uniform approach to validate different type of payloads supporting REST, SOAP, XML, Java VO and other types of payloads • Provide support for field level validations (example: validate inbound message attributes) • Provide support for custom validations (based on business logic) • Support context specific messages for validation errors from configuration files • Raise validation errors for handling alternate flow of execution • Inject validators as pluggable components in flow
  • 5. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential Mule offerings and shortcomings • Mule supports validations to an extent but that is not sufficient; for example • The validator pattern from Mule supports validation using MEL which is barely sufficient; forcing to write MEL for every attribute and has no option to wire to an error code/message • The JSON validator checks whether the input JSON is formatted. It does not support features to apply a constraint like checking the length of an attribute, for null value or for an empty string, etc.
  • 6. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential Benefits of JSR303 specification • Java Bean Validation (JSR303) is a framework as part of Java EE. • The bean validation defines meta model and API for data validation. • The implementation is done through annotations and is extensible, which can be reused by simply adding annotations to the domain model. // Example – define constraints to a bean public class Person { @NotNull (message=’ERR-BS-001’) public class Person{ @NotNull (message=’ERR-BS-001’) @Size(min=1, max=16) private String firstName; @NotNull (message=’ERR-BS-002’) @Size(min=1, max=16) private String lastName;
  • 7. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential • Spring framework supports JSR303 bean validations and support for custom validation. Some of the advantages upon using Spring Validators are mentioned below: • Spring framework is a natural choice of Mule for DI – No additional set-up is required • Custom Spring Validators can be injected to a Mule ESB flow so as to validate business logic • Supports JSR 303 validation by making use of a reference implementation like Hibernate Validator API or Apache BVal API • Link validation errors using Spring property placeholders for error messages which are context specific 7 Benefits of Spring Validators
  • 8. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential A validation framework is necessary, which binds annotation validators, custom validators and error message handler. 8 Blending all together
  • 9. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential • To validate annotations, JSR303 RI is required in the library. Hibernate Validator or Apache’s BVal can be used to support annotation based validations. • To validate concrete domain models, Spring framework’s ValidationUtils class should be used (from springframework.validation package). The ValidationUtil’s method should invoke a custom validator thus providing FieldErrors. • The ExceptionFactory consolidates the FieldErrors from different validators, fetches the attribute name and message ID and loads the message from the message source. • Custom validators to the ValidationUtils should be injected as Spring beans in Mule. • Exception factory should use Spring’s PropertiesFactoryBean to load error messages at runtime. 9 Cont..
  • 10. 2014 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential2015 © WHISHWORKS. All rights reserved. WHISHWORKS Confidential • It might be possible to use annotations in order to validate REST requests by using @Valid annotation. • Mule ESB 6.1 has upgraded Jersey version 2.11 (RI) which supports validation using @Valid annotation prior to a REST method invocation (like in Spring MVC). // update user profile after validation @POST @Consumes( MediaType.APPLICATION_JSON_VALUE ) public boolean updateProfile( @Valid UserProfile mProfile ) //… } 10 Go for the extra mile!