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

What's hot (11)

PPTX
Wildcard Filter
sivachandra mandalapu
 
PPTX
Data Mapper
sivachandra mandalapu
 
PPTX
Filter expression in mule
Rajkattamuri
 
PPTX
Quartz component in mule
javeed_mhd
 
ODP
Howtouseforeachcomponent
akshay yeluru
 
PPTX
Splitter
sivachandra mandalapu
 
PPTX
For each component in mule
Rajkattamuri
 
PPTX
Sftplite
sivachandra mandalapu
 
PPTX
Object store
sivachandra mandalapu
 
PPTX
Mock component in munit
sivachandra mandalapu
 
PPTX
Jms selector
sivachandra mandalapu
 
Wildcard Filter
sivachandra mandalapu
 
Filter expression in mule
Rajkattamuri
 
Quartz component in mule
javeed_mhd
 
Howtouseforeachcomponent
akshay yeluru
 
For each component in mule
Rajkattamuri
 
Object store
sivachandra mandalapu
 
Mock component in munit
sivachandra mandalapu
 
Jms selector
sivachandra mandalapu
 

Viewers also liked (18)

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

Similar to Defining global exception strategies (20)

PPTX
How to use expression filter
Phaniu
 
PPTX
How to use expression filter
irfan1008
 
PPTX
How to use expression filter
mdfkhan625
 
PPTX
How to use expression filter
princeirfancivil
 
PPTX
How to use expression filter
Khasim Saheb
 
PPTX
How to use expression filter
Anand kalla
 
PPTX
How to use expression filter
Sunil Komarapu
 
PPTX
Expression Filters
Durga Prasad Kakarla
 
PPTX
Filter expression in mule
javeed_mhd
 
PPTX
Filter expression
F K
 
PPTX
Filter expression
AbdulImrankhan7
 
PPTX
Filter expression
Sunil Komarapu
 
PPTX
How to use expression filter
RaviRajuRamaKrishna
 
PPTX
How to use message properties component
irfan1008
 
PPTX
How to use message properties component
Phaniu
 
PPTX
How to use message properties component
mdfkhan625
 
PPTX
How to use message properties component
princeirfancivil
 
PPTX
How to use wildcard filter
RaviRajuRamaKrishna
 
PPTX
Mule Message Properties Component
Durga Prasad Kakarla
 
PPTX
How to use message properties component
maheshtheapex
 
How to use expression filter
Phaniu
 
How to use expression filter
irfan1008
 
How to use expression filter
mdfkhan625
 
How to use expression filter
princeirfancivil
 
How to use expression filter
Khasim Saheb
 
How to use expression filter
Anand kalla
 
How to use expression filter
Sunil Komarapu
 
Expression Filters
Durga Prasad Kakarla
 
Filter expression in mule
javeed_mhd
 
Filter expression
F K
 
Filter expression
AbdulImrankhan7
 
Filter expression
Sunil Komarapu
 
How to use expression filter
RaviRajuRamaKrishna
 
How to use message properties component
irfan1008
 
How to use message properties component
Phaniu
 
How to use message properties component
mdfkhan625
 
How to use message properties component
princeirfancivil
 
How to use wildcard filter
RaviRajuRamaKrishna
 
Mule Message Properties Component
Durga Prasad Kakarla
 
How to use message properties component
maheshtheapex
 
Ad

Recently uploaded (20)

PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PDF
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PPTX
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
CHILD RIGHTS AND PROTECTION QUESTION BANK
Dr Raja Mohammed T
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
CHILD RIGHTS AND PROTECTION QUESTION BANK
Dr Raja Mohammed T
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 

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)