2. Abstract
• The main motto of this PPT is How to use
Reference Exception Strategy in our
applications.
3. Introduction
• You can create one or more global exception
strategies to reuse in flows throughout your
entire Mule application. First, create a global
exception strategy, then add a Reference
Exception Strategy to a flow to apply the error
handling behavior of a specific global
exception strategy.
7. • Output:
• If the input is valid input:
• INFO 2016-12-22 09:23:32,157
[[JsonSchemaValidator].HTTP_Listener_Config
uration.worker.02]
org.mule.api.processor.LoggerMessageProcess
or: --Valid input
8. • If the input is invalid input:
• ERROR 2016-12-22 09:23:15,139 [[JsonSchemaValidator].HTTP_Listener_Configuration.worker.02] org.mule.exception.DefaultMessagingExceptionStrategy:
• ********************************************************************************
• Message : Json content is not compliant with schema
• com.github.fge.jsonschema.core.report.ListProcessingReport: failure
• --- BEGIN MESSAGES ---
• error: object has missing required properties (["firstName"])
• level: "error"
• schema: {"loadingURI":"file:/C:/Users/sivachandra.mandalap/AnypointStudio/workspace1/.mule/apps/JsonSchemaValidator/classes/Schema.json#","pointer":""}
• instance: {"pointer":""}
• domain: "validation"
• keyword: "required"
• required: ["firstName","lastName"]
• missing: ["firstName"]
• --- END MESSAGES ---
• Payload : {"lastName":"def","age":10}
• Payload Type : java.lang.String
• Element : /JsonSchemaValidatorFlow/processors/0 @ JsonSchemaValidator
• --------------------------------------------------------------------------------
• Root Exception stack trace:
• org.mule.module.json.validation.JsonSchemaValidationException: Json content is not compliant with schema
• com.github.fge.jsonschema.core.report.ListProcessingReport: failure
• --- BEGIN MESSAGES ---
• error: object has missing required properties (["firstName"])
• level: "error"
• schema: {"loadingURI":"file:/C:/Users/sivachandra.mandalap/AnypointStudio/workspace1/.mule/apps/JsonSchemaValidator/classes/Schema.json#","pointer":""}
• instance: {"pointer":""}
• domain: "validation"
• keyword: "required"
• required: ["firstName","lastName"]
• missing: ["firstName"]
• --- END MESSAGES ---
• at org.mule.module.json.validation.JsonSchemaValidator.validate(JsonSchemaValidator.java:286)
• at org.mule.module.json.validation.ValidateJsonSchemaMessageProcessor.process(ValidateJsonSchemaMessageProcessor.java:46)
• at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
• at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108)
• at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
9. • Flow of execution:
1. URL to trigger the service from browser
Valid Request: