SlideShare a Scribd company logo
Defining global exception strategies
Abstract
• The main motto of this PPT is How to use
Defining global exception strategies in our
applications.
Example
Defining global exception strategies
.mflow
• <?xml version="1.0" encoding="UTF-8"?>
• <mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
• xmlns:spring="http://www.springframework.org/schema/beans"
• xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
• xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
• http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
• http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
• <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8088" doc:name="HTTP
Listener Configuration"/>
• <flow name="ExceptionHandlingFlow">
• <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
• <logger message="-Flow started" level="INFO" doc:name="Logger"/>
• <set-property propertyName="token"
value="#[message.inboundProperties.'http.query.params'.token.toString()]" doc:name="Property"/>
• <logger message="--Token value: ----#[message.outboundProperties.token]" level="INFO"
doc:name="Logger"/>
• <set-payload value="{
• &quot;token&quot;:&quot;#[message.outboundProperties.token]&quot;
• }" doc:name="Set Payload"/>
• <exception-strategy ref="GlobalCatch_Exception_Strategy" doc:name="Reference Exception Strategy"/>
• </flow>
• </mule>
• Global flow:
• <?xml version="1.0" encoding="UTF-8"?>
• <mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
• xmlns:spring="http://www.springframework.org/schema/beans"
• xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
• xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
• http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
• <catch-exception-strategy name="GlobalCatch_Exception_Strategy">
• <set-property propertyName="http.status" value="400" doc:name="Property"/>
• <set-payload value="{
• &quot;message&quot;:&quot;Bad Request&quot;
• }" doc:name="Set Payload"/>
• </catch-exception-strategy>
• </mule>
• Output:
• If the input is valid input:
• INFO 2016-12-23 09:50:35,930
[[ExceptionHandling].HTTP_Listener_Configuratio
n.worker.01]
org.mule.api.processor.LoggerMessageProcessor:
-Flow started
• INFO 2016-12-23 09:50:35,978
[[ExceptionHandling].HTTP_Listener_Configuratio
n.worker.01]
org.mule.api.processor.LoggerMessageProcessor:
--Token value: ----a1b2c3d4
Defining global exception strategies
• If the input is invalid input:
• NFO 2016-12-23 09:51:25,543 [[ExceptionHandling].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: -Flow started
• ERROR 2016-12-23 09:51:25,552 [[ExceptionHandling].HTTP_Listener_Configuration.worker.01]
org.mule.exception.CatchMessagingExceptionStrategy:
• ********************************************************************************
• Message : Execution of the expression
"message.inboundProperties.'http.query.params'.token.toString()" failed.
(org.mule.api.expression.ExpressionRuntimeException).
• Payload : {NullPayload}
• Element XML : <set-property propertyName="token"
value="#[message.inboundProperties.'http.query.params'.token.toString()]"
doc:name="Property"></set-property>
• Payload Type : org.mule.transport.NullPayload
• Element : /ExceptionHandlingFlow/processors/1 @
ExceptionHandling:ExceptionHandling.xml:13 (Property)
• --------------------------------------------------------------------------------
• Root Exception stack trace:
• java.lang.NullPointerException
• at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
• at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Defining global exception strategies
References
• https://docs.mulesoft.com/mule-user-
guide/v/3.6/error-handling

More Related Content

PPTX
Collection aggregator
PPTX
Specifying a default exception strategy
PPTX
Reference exception strategy
PPTX
PPTX
Property place holder
PPTX
Validate json schema
PPTX
How to use expression filter
PPTX
Expression filter in Mule
Collection aggregator
Specifying a default exception strategy
Reference exception strategy
Property place holder
Validate json schema
How to use expression filter
Expression filter in Mule

What's hot (11)

PPTX
Wildcard Filter
PPTX
PPTX
Filter expression in mule
PPTX
Quartz component in mule
ODP
Howtouseforeachcomponent
PPTX
PPTX
For each component in mule
PPTX
PPTX
Object store
PPTX
Mock component in munit
PPTX
Jms selector
Wildcard Filter
Filter expression in mule
Quartz component in mule
Howtouseforeachcomponent
For each component in mule
Object store
Mock component in munit
Jms selector
Ad

Viewers also liked (18)

PPTX
Cloud hub deployment
PPTX
Bean as Datasource
PPTX
Securing api with_o_auth2
PPTX
PPTX
PPTX
Synchronous communication using jms back channel
PPTX
Setting up organization with api access
PPTX
Deployment options for mule applications
PPTX
How to use secure property placeholder
PPTX
API gateway setup
PPTX
How to use SFTP
PPTX
Dockerizing mule soft esb
PPTX
How to use jms outbound endpoint
PPTX
How to use IMAP endpoint
PPTX
How to use poll scope
PPTX
PPTX
Integrate mule esb with microsoft office 365 share point
Cloud hub deployment
Bean as Datasource
Securing api with_o_auth2
Synchronous communication using jms back channel
Setting up organization with api access
Deployment options for mule applications
How to use secure property placeholder
API gateway setup
How to use SFTP
Dockerizing mule soft esb
How to use jms outbound endpoint
How to use IMAP endpoint
How to use poll scope
Integrate mule esb with microsoft office 365 share point
Ad

Similar to Defining global exception strategies (20)

PPTX
How to use expression filter
PPTX
How to use expression filter
PPTX
How to use expression filter
PPTX
How to use expression filter
PPTX
How to use expression filter
PPTX
How to use expression filter
PPTX
How to use expression filter
PPTX
Expression Filters
PPTX
Filter expression
 
PPTX
Filter expression in mule
PPTX
Filter expression
PPTX
Filter expression
PPTX
How to use expression filter
PPTX
How to use message properties component
PPTX
How to use message properties component
PPTX
How to use message properties component
PPTX
How to use message properties component
PPTX
How to use wildcard filter
PPTX
Mule Message Properties Component
PPTX
How to use message properties component
How to use expression filter
How to use expression filter
How to use expression filter
How to use expression filter
How to use expression filter
How to use expression filter
How to use expression filter
Expression Filters
Filter expression
 
Filter expression in mule
Filter expression
Filter expression
How to use expression filter
How to use message properties component
How to use message properties component
How to use message properties component
How to use message properties component
How to use wildcard filter
Mule Message Properties Component
How to use message properties component

Recently uploaded (20)

PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
RMMM.pdf make it easy to upload and study
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Cell Structure & Organelles in detailed.
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Classroom Observation Tools for Teachers
PPTX
Institutional Correction lecture only . . .
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
GDM (1) (1).pptx small presentation for students
Final Presentation General Medicine 03-08-2024.pptx
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
TR - Agricultural Crops Production NC III.pdf
human mycosis Human fungal infections are called human mycosis..pptx
PPH.pptx obstetrics and gynecology in nursing
RMMM.pdf make it easy to upload and study
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Cell Structure & Organelles in detailed.
Microbial diseases, their pathogenesis and prophylaxis
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
VCE English Exam - Section C Student Revision Booklet
Classroom Observation Tools for Teachers
Institutional Correction lecture only . . .
01-Introduction-to-Information-Management.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Module 4: Burden of Disease Tutorial Slides S2 2025
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx

Defining global exception strategies

  • 2. Abstract • The main motto of this PPT is How to use Defining global exception strategies in our applications.
  • 5. .mflow • <?xml version="1.0" encoding="UTF-8"?> • <mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" • xmlns:spring="http://www.springframework.org/schema/beans" • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" • xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd • http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd • http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"> • <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8088" doc:name="HTTP Listener Configuration"/> • <flow name="ExceptionHandlingFlow"> • <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> • <logger message="-Flow started" level="INFO" doc:name="Logger"/> • <set-property propertyName="token" value="#[message.inboundProperties.'http.query.params'.token.toString()]" doc:name="Property"/> • <logger message="--Token value: ----#[message.outboundProperties.token]" level="INFO" doc:name="Logger"/> • <set-payload value="{ • &quot;token&quot;:&quot;#[message.outboundProperties.token]&quot; • }" doc:name="Set Payload"/> • <exception-strategy ref="GlobalCatch_Exception_Strategy" doc:name="Reference Exception Strategy"/> • </flow> • </mule>
  • 6. • Global flow: • <?xml version="1.0" encoding="UTF-8"?> • <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" • xmlns:spring="http://www.springframework.org/schema/beans" • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" • xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd • http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd"> • <catch-exception-strategy name="GlobalCatch_Exception_Strategy"> • <set-property propertyName="http.status" value="400" doc:name="Property"/> • <set-payload value="{ • &quot;message&quot;:&quot;Bad Request&quot; • }" doc:name="Set Payload"/> • </catch-exception-strategy> • </mule>
  • 7. • Output: • If the input is valid input: • INFO 2016-12-23 09:50:35,930 [[ExceptionHandling].HTTP_Listener_Configuratio n.worker.01] org.mule.api.processor.LoggerMessageProcessor: -Flow started • INFO 2016-12-23 09:50:35,978 [[ExceptionHandling].HTTP_Listener_Configuratio n.worker.01] org.mule.api.processor.LoggerMessageProcessor: --Token value: ----a1b2c3d4
  • 9. • If the input is invalid input: • NFO 2016-12-23 09:51:25,543 [[ExceptionHandling].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: -Flow started • ERROR 2016-12-23 09:51:25,552 [[ExceptionHandling].HTTP_Listener_Configuration.worker.01] org.mule.exception.CatchMessagingExceptionStrategy: • ******************************************************************************** • Message : Execution of the expression "message.inboundProperties.'http.query.params'.token.toString()" failed. (org.mule.api.expression.ExpressionRuntimeException). • Payload : {NullPayload} • Element XML : <set-property propertyName="token" value="#[message.inboundProperties.'http.query.params'.token.toString()]" doc:name="Property"></set-property> • Payload Type : org.mule.transport.NullPayload • Element : /ExceptionHandlingFlow/processors/1 @ ExceptionHandling:ExceptionHandling.xml:13 (Property) • -------------------------------------------------------------------------------- • Root Exception stack trace: • java.lang.NullPointerException • at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) • at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) • at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)