SlideShare a Scribd company logo
June 12 , 2021
Dubai – MuleSoft Meetup Group
Error Handling in MuleSoft
2
● Introductions
● Error Handling
● Retry
● Reprocessing
● Log Management
● Wrap-up
Agenda
3
●About the organizer & Speaker:
Introductions
A SHOW OF HANDS:
Who is new to this Meetup?
Error Handling in MuleSoft
5
●An exception occurs when an unexpected event
happens while processing.
●Exception handling is the process of responding to
exceptions when a computer program runs.
●In Mule we can handle the message exception at
different level
Error Handling
Error Handling
● At Project level using Default error handler
● At Project level using Custom Global error handler
● At Flow level in exception handling using :
On Error Continue
On Error Propagate
Raise Error
● With in Flow or at processor level using try scope
6
Error Handling
● Whenever there is an error occurred in a Flow, an error Object is created
● It contains many properties . Eg : error.description , error.errorType etc
● Mule identifies based on error Type and then route to respective blocks that
are placed in Error Handler.
● errorType is combination of Namespace and Identifier :
Eg : HTTP:UNAUTHORIZED
● Here :
namespace = HTTP
Identifier = UNAUTHORIZED
7
Error Handling
● Sub-Flow doesn’t have Error Handling scope
● So, its just Flow and a Private flow where you can place On-Error-Propagate
and On-Error-Continue inside Error-handling block.
● Either it is Propagate or Continue, Mule Executes all the components within
that block
● The error will route to error-handling only if it identifies that the errorType of
that error is handled
● Mule 4 has one excellent feature of Identifying the types of errors that can
occur within that flow by looking at what kind of connectors are placed in that
flow.
8
Error Handling
9
Error Handling
● See if anything is present in Error-Handling
● Even if there are on-errorpropagate and on-error-continue blocks, see that if
that errorType is handled
● If NOT, then Mule will use default Error Handling
● If your flow is not called by any other flow , then it will display default value
that is set in Error-Response and gives status code as 500 bad default if
nothing is set manually
10
11
Error Handling
● There’s something handled in Error-Handler. But errorType is not Matching
with Handled errorType. So don’t care whether it’s error- continue or error-
propagate. When errorType not matched, it will use default error handler by
mule.
Actual errorType = HTTP:CONNECTIVITY
Handled errorType = HTTP:BAD-REQUEST
● It uses Mule’s default error-handling.
● It will print the payload whatever is coming from input just before Http Request
with status code 500
12
13
Error Handling
● There’s something handled in Error-Handler. And errorType is Matching with
Handled errorType.
Actual errorType = HTTP:CONNECTIVITY
Handled errorType = HTTP:CONNECTIVITY
● The flow is using On-Error-Continue . It executes all components in this block.
In this block we are setting payload message with value “Error Handled in
Main flow”.
● it will execute processors in Error-Continue and end the process with 200
status
14
Error Handling
● If some Error Handling is present in that flow and errorType is handled
● Check whether it is On-Error-continue or On- ErrorPropagate
● In both the cases, Mule will execute all components within that block.
● If the error is handled using On-Error Propagate , it will raise an error back to
the calling flow.
● If the error is handled using On-Error Continue , it will not raise an error back
to the calling flow and continue to next processor after “flow-ref” and continues
further process as it is. But it will not continue to other processors in the flow
where error is handled.
● Suppose you have only single flow. Then On-error-propagate and On-error-
Continue behaves same way, instead On-error-continues gives 200 status
and on-error-propagate gives 500 status.
15
Error Handling
● A Raise error is a core component generates a mule error ,as if a failure had
occurred, which allows you to customize its description and type.
● Use this component to only Raise :
Core run time errors, such as MULE:SECURITY, MULE:CONNECTIVITY,
etc.
Custom error types Eg : ORDER:INVALID
● You can not use a connectors existing namespace.
For Raise Error : HTTP:ITEM_NOT_FOUND (wrong)
ITEM:NOT_FOUND (correct)
16
Retry
● Re-connection strategy which we can define on the connectors but that only
retries in case of failure in connection.
● To achieve this, retry mechanism we can use Until Successful
● The until successful scope is one of the scopes available in Mule which
processes messages through its processors until the process succeeds.
● After passing a message into the until successful scope, the main flow
immediately regains control of the thread.
● By default, the Until Successful scope runs asynchronously, but you can
always configure it as synchronous.
17
Retry
● maxRetries: Specifies the maximum number of retries that are attempted.
● millisBetweenRetries: Specifies the minimum interval between two attempts
to process, in milliseconds. The actual interval depends on the previous
execution but should not exceed twice this number. The default value is 60000
milliseconds (one minute).
18
19
Reprocessing
● MuleSoft allows you to process messages as a batch which can be achieved
by batch scope.
● Batch scope in a mule application can divide the input payload into individual
records, performs actions on these individual records, and then sends the
processed data to target systems.
● Within an application, you can initiate a Batch Job scope, which splits
messages into individual records, performs actions upon each record, and
then reports on the results and potentially pushes the processed output to
other systems or queues.
20
21
Log Management
● Logging is useful for monitoring and troubleshooting your Mule
applications and the Mule server whether that's recording errors raised by
the application or specific details, such as status notifications, custom
metadata, and payloads.
● Loggers can be configured to determine what specific packages are to be
logged and to what depth where packages are a grouped set of classes and
interfaces, represented by a namespace.
● Appenders essentially describe how to deliver the logging events to a
destination. Think about where you typically see log events outputted from
your Mule applications the Console view in Anypoint Studio and the log files of
the application itself both are examples of Appenders
22
The default log4j2.xml file
23
Logger Configuration
24
Fields:
Message, Level, Category
● Message :
Specifies the Mule log message.
By default, messages are logged to the application’s log file.
● Level :
Specifies the log level.
Available options are DEBUG , ERROR , INFO(Default) , TRACE , WARN
● Category :
Optional setting that specifies a category name that it adds to log4j2.xml
file. For example, you might use a category to route your log messages
based on your category, or you might set log levels based on category.
25
26
● Share:
○ Tweet using the hashtag #MuleSoftMeetups
○ Invite your network to join: https://meetups.mulesoft.com/dubai/
Feedback:
○ Fill out the survey feedback and suggest topics for upcoming events
○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program
What’s next?
Introduce yourself to your neighbor
Networking time
Thank you

More Related Content

PPTX
Mule soft meetup__riyadh_08_nov_2020
PDF
[Final] best practices for access management (mule soft meetups riyadh) - j...
PPTX
#5-Calicut-MuleSoft-Meetup-User-Management-in-AnypointPlatform
PPTX
Mule soft meetup__adelaide_october_2020_final (2)
PPTX
MuleSoft Meetup Houston #15
PDF
MuleSoft MUnit Test Recorder Meetup
PDF
MuleSoft: How to Engage Partners/Customers and API Led with Alexa
PDF
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups
Mule soft meetup__riyadh_08_nov_2020
[Final] best practices for access management (mule soft meetups riyadh) - j...
#5-Calicut-MuleSoft-Meetup-User-Management-in-AnypointPlatform
Mule soft meetup__adelaide_october_2020_final (2)
MuleSoft Meetup Houston #15
MuleSoft MUnit Test Recorder Meetup
MuleSoft: How to Engage Partners/Customers and API Led with Alexa
MuleSoft Runtime Fabric (RTF): Foundations : MuleSoft Virtual Muleys Meetups

What's hot (20)

PPTX
MuleSoft Meetup Adelaide 7th April 2021
PDF
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
PPTX
Mule soft meetup_-_finland_september_25th__2020 v2.0
PPTX
Rtf externalize tls MuleSoft meetup
PPTX
Mule soft meetup_virtual_ 3_charlotte_07july_2021__final
PPTX
Toronto mule soft meetup november 2021
PPTX
MuleSoft Meetup Bangalore - March 6 2021
PPTX
Managing APIs with MuleSoft
PPTX
MuleSoft Meetup Roma - Processi di Automazione su CloudHub
PDF
MuleSoft Meetup - Women Who Mule JAPAC November 2021
PDF
Metadata definition between flows on Studio 7 : MuleSoft Virtual Muleys Meetups
PPTX
mulesoft meetup @ bangalore
PDF
Ready bytes labs products
PPTX
Meetup bangalore-may22nd2021
PPTX
Vancouver mulesoft meetup_23-july
PDF
Testing strategies and best practices using MUnit
PPTX
Cracow MuleSoft Meetup #1
PDF
Mule soft meetups-24012020
PDF
MuleSoft Meetup #2 in Kyiv, Ukraine - What is special about MuleSoft Catalyst™?
PDF
#1 MuleSoft Meetup in Geneva
MuleSoft Meetup Adelaide 7th April 2021
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
Mule soft meetup_-_finland_september_25th__2020 v2.0
Rtf externalize tls MuleSoft meetup
Mule soft meetup_virtual_ 3_charlotte_07july_2021__final
Toronto mule soft meetup november 2021
MuleSoft Meetup Bangalore - March 6 2021
Managing APIs with MuleSoft
MuleSoft Meetup Roma - Processi di Automazione su CloudHub
MuleSoft Meetup - Women Who Mule JAPAC November 2021
Metadata definition between flows on Studio 7 : MuleSoft Virtual Muleys Meetups
mulesoft meetup @ bangalore
Ready bytes labs products
Meetup bangalore-may22nd2021
Vancouver mulesoft meetup_23-july
Testing strategies and best practices using MUnit
Cracow MuleSoft Meetup #1
Mule soft meetups-24012020
MuleSoft Meetup #2 in Kyiv, Ukraine - What is special about MuleSoft Catalyst™?
#1 MuleSoft Meetup in Geneva
Ad

Similar to Mule soft meetup__dubai_12_june- Error Handling (20)

PPTX
Coimbatore Second Mule Meetup on Error Handling in Mule 4
PPTX
Coimbatore meetup error handling 24apr2021
PPTX
Exception handling in Mule 4 _Virtual mule soft meetup may_2020
PPTX
Virtual MuleSoft Meetup may_2020
PDF
Engineering Student MuleSoft Meetup#5 - Error Handling With MuleSoft
PPTX
Mulesoft meetup slides mumbai_20113019_exception_handling
PPT
Error Handling in Mulesoft
PPTX
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
PPTX
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
PPTX
Online Spanish meetup #1
PPTX
Mule meetup Hyderabad
PPTX
Error Handling In Mule 4 | MuleSoft Mysore Meetup #10
PDF
Virtual Meetup: Mule 4 Error Handling and Logging
PPTX
Indore MuleSoft Meetup #4 : Demystifying Error Handling & Snowflake Integration
PPTX
MuleSoft Kochi Meetup #5– Handling Mule Exceptions
PPTX
Elements in a mule flow
PPTX
Elements in a muleflow
PPTX
Global Exception Handling Custom Error Connector In MuleSoft
PDF
MuleSoft Surat Meetup#47 - Error Handling With MuleSoft
ODP
Mule scopes&error handling
Coimbatore Second Mule Meetup on Error Handling in Mule 4
Coimbatore meetup error handling 24apr2021
Exception handling in Mule 4 _Virtual mule soft meetup may_2020
Virtual MuleSoft Meetup may_2020
Engineering Student MuleSoft Meetup#5 - Error Handling With MuleSoft
Mulesoft meetup slides mumbai_20113019_exception_handling
Error Handling in Mulesoft
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Online Spanish meetup #1
Mule meetup Hyderabad
Error Handling In Mule 4 | MuleSoft Mysore Meetup #10
Virtual Meetup: Mule 4 Error Handling and Logging
Indore MuleSoft Meetup #4 : Demystifying Error Handling & Snowflake Integration
MuleSoft Kochi Meetup #5– Handling Mule Exceptions
Elements in a mule flow
Elements in a muleflow
Global Exception Handling Custom Error Connector In MuleSoft
MuleSoft Surat Meetup#47 - Error Handling With MuleSoft
Mule scopes&error handling
Ad

More from satyasekhar123 (8)

PDF
MuleSoft Meetup Dubai Anypoint security with api-led Connectivity
PPTX
Dubai meetup- Anypoint Runtime Fabric
PPTX
Riyadh Meetup4- Sonarqube for Mule 4 Code review
PPTX
Mule soft riyadh virtual meetup_30_aug
PDF
Mule soft riyadh virtual meetup_25_jul
PPTX
PPTX
Managing_Alfresco_Content_from_within_MS_Office_for_Enterprise.PPTX
PDF
WebClient Customization.pdf
MuleSoft Meetup Dubai Anypoint security with api-led Connectivity
Dubai meetup- Anypoint Runtime Fabric
Riyadh Meetup4- Sonarqube for Mule 4 Code review
Mule soft riyadh virtual meetup_30_aug
Mule soft riyadh virtual meetup_25_jul
Managing_Alfresco_Content_from_within_MS_Office_for_Enterprise.PPTX
WebClient Customization.pdf

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Empathic Computing: Creating Shared Understanding
PDF
cuic standard and advanced reporting.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Approach and Philosophy of On baking technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Modernizing your data center with Dell and AMD
Network Security Unit 5.pdf for BCA BBA.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Empathic Computing: Creating Shared Understanding
cuic standard and advanced reporting.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
A Presentation on Artificial Intelligence
Approach and Philosophy of On baking technology
Spectral efficient network and resource selection model in 5G networks
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Understanding_Digital_Forensics_Presentation.pptx
MYSQL Presentation for SQL database connectivity
Modernizing your data center with Dell and AMD

Mule soft meetup__dubai_12_june- Error Handling

  • 1. June 12 , 2021 Dubai – MuleSoft Meetup Group Error Handling in MuleSoft
  • 2. 2 ● Introductions ● Error Handling ● Retry ● Reprocessing ● Log Management ● Wrap-up Agenda
  • 3. 3 ●About the organizer & Speaker: Introductions A SHOW OF HANDS: Who is new to this Meetup?
  • 4. Error Handling in MuleSoft
  • 5. 5 ●An exception occurs when an unexpected event happens while processing. ●Exception handling is the process of responding to exceptions when a computer program runs. ●In Mule we can handle the message exception at different level Error Handling
  • 6. Error Handling ● At Project level using Default error handler ● At Project level using Custom Global error handler ● At Flow level in exception handling using : On Error Continue On Error Propagate Raise Error ● With in Flow or at processor level using try scope 6
  • 7. Error Handling ● Whenever there is an error occurred in a Flow, an error Object is created ● It contains many properties . Eg : error.description , error.errorType etc ● Mule identifies based on error Type and then route to respective blocks that are placed in Error Handler. ● errorType is combination of Namespace and Identifier : Eg : HTTP:UNAUTHORIZED ● Here : namespace = HTTP Identifier = UNAUTHORIZED 7
  • 8. Error Handling ● Sub-Flow doesn’t have Error Handling scope ● So, its just Flow and a Private flow where you can place On-Error-Propagate and On-Error-Continue inside Error-handling block. ● Either it is Propagate or Continue, Mule Executes all the components within that block ● The error will route to error-handling only if it identifies that the errorType of that error is handled ● Mule 4 has one excellent feature of Identifying the types of errors that can occur within that flow by looking at what kind of connectors are placed in that flow. 8
  • 10. Error Handling ● See if anything is present in Error-Handling ● Even if there are on-errorpropagate and on-error-continue blocks, see that if that errorType is handled ● If NOT, then Mule will use default Error Handling ● If your flow is not called by any other flow , then it will display default value that is set in Error-Response and gives status code as 500 bad default if nothing is set manually 10
  • 11. 11
  • 12. Error Handling ● There’s something handled in Error-Handler. But errorType is not Matching with Handled errorType. So don’t care whether it’s error- continue or error- propagate. When errorType not matched, it will use default error handler by mule. Actual errorType = HTTP:CONNECTIVITY Handled errorType = HTTP:BAD-REQUEST ● It uses Mule’s default error-handling. ● It will print the payload whatever is coming from input just before Http Request with status code 500 12
  • 13. 13
  • 14. Error Handling ● There’s something handled in Error-Handler. And errorType is Matching with Handled errorType. Actual errorType = HTTP:CONNECTIVITY Handled errorType = HTTP:CONNECTIVITY ● The flow is using On-Error-Continue . It executes all components in this block. In this block we are setting payload message with value “Error Handled in Main flow”. ● it will execute processors in Error-Continue and end the process with 200 status 14
  • 15. Error Handling ● If some Error Handling is present in that flow and errorType is handled ● Check whether it is On-Error-continue or On- ErrorPropagate ● In both the cases, Mule will execute all components within that block. ● If the error is handled using On-Error Propagate , it will raise an error back to the calling flow. ● If the error is handled using On-Error Continue , it will not raise an error back to the calling flow and continue to next processor after “flow-ref” and continues further process as it is. But it will not continue to other processors in the flow where error is handled. ● Suppose you have only single flow. Then On-error-propagate and On-error- Continue behaves same way, instead On-error-continues gives 200 status and on-error-propagate gives 500 status. 15
  • 16. Error Handling ● A Raise error is a core component generates a mule error ,as if a failure had occurred, which allows you to customize its description and type. ● Use this component to only Raise : Core run time errors, such as MULE:SECURITY, MULE:CONNECTIVITY, etc. Custom error types Eg : ORDER:INVALID ● You can not use a connectors existing namespace. For Raise Error : HTTP:ITEM_NOT_FOUND (wrong) ITEM:NOT_FOUND (correct) 16
  • 17. Retry ● Re-connection strategy which we can define on the connectors but that only retries in case of failure in connection. ● To achieve this, retry mechanism we can use Until Successful ● The until successful scope is one of the scopes available in Mule which processes messages through its processors until the process succeeds. ● After passing a message into the until successful scope, the main flow immediately regains control of the thread. ● By default, the Until Successful scope runs asynchronously, but you can always configure it as synchronous. 17
  • 18. Retry ● maxRetries: Specifies the maximum number of retries that are attempted. ● millisBetweenRetries: Specifies the minimum interval between two attempts to process, in milliseconds. The actual interval depends on the previous execution but should not exceed twice this number. The default value is 60000 milliseconds (one minute). 18
  • 19. 19
  • 20. Reprocessing ● MuleSoft allows you to process messages as a batch which can be achieved by batch scope. ● Batch scope in a mule application can divide the input payload into individual records, performs actions on these individual records, and then sends the processed data to target systems. ● Within an application, you can initiate a Batch Job scope, which splits messages into individual records, performs actions upon each record, and then reports on the results and potentially pushes the processed output to other systems or queues. 20
  • 21. 21
  • 22. Log Management ● Logging is useful for monitoring and troubleshooting your Mule applications and the Mule server whether that's recording errors raised by the application or specific details, such as status notifications, custom metadata, and payloads. ● Loggers can be configured to determine what specific packages are to be logged and to what depth where packages are a grouped set of classes and interfaces, represented by a namespace. ● Appenders essentially describe how to deliver the logging events to a destination. Think about where you typically see log events outputted from your Mule applications the Console view in Anypoint Studio and the log files of the application itself both are examples of Appenders 22
  • 25. Fields: Message, Level, Category ● Message : Specifies the Mule log message. By default, messages are logged to the application’s log file. ● Level : Specifies the log level. Available options are DEBUG , ERROR , INFO(Default) , TRACE , WARN ● Category : Optional setting that specifies a category name that it adds to log4j2.xml file. For example, you might use a category to route your log messages based on your category, or you might set log levels based on category. 25
  • 26. 26 ● Share: ○ Tweet using the hashtag #MuleSoftMeetups ○ Invite your network to join: https://meetups.mulesoft.com/dubai/ Feedback: ○ Fill out the survey feedback and suggest topics for upcoming events ○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program What’s next?
  • 27. Introduce yourself to your neighbor Networking time