It's time for our Mule Meet up in Reading (Virtual). Two interesting and informative topics are on the agenda.
Topic 1
Transaction management in MuleSoft
In a nutshell, a transaction is a group of actions that should be performed as one 'bulk action'. During this session, we will discuss how we can achieve it by using connectors, scopes, and exception handlers.
Topic 2
How to automate issue fixing in MuleSoft?
The presentation will discuss how the identified issues can be fixed in an automated manner, resulting in huge time & cost savings, code standardization, etc.
Watch now!
Book now online demo of IZ Analyzer: https://integralzone.com/book-online-demo/
2. PAGE 2
✔ This will be a recorded session.
✔ Please be on mute during the speaker session.
✔ At the end of each speaker presentation, you can ask questions using chat or Q&A
options.
✔ A quiz will be conducted at the end of the session.
✔ The recordings and slides of the session will be made available to all the attendees.
House rules
2
3. PAGE 3
Agenda
5pm – 5.15pm Introductions
5:15pm Speaker Session I: MuleSoft Transaction types followed by QnA
5:45pm Speaker Session II: Code quality analysis followed by QnA
6:15pm Quiz
5:45pm Closure
3
4. PAGE 4
Saurabh Vatsa
Solution Architect,
MuleSoft Mentor
Integral Zone
Speakers
Naveen
Manager: Product Sales
Integral Zone
Speaker Host Speaker
Hitesh Joshi
Senior MuleSoft Consultant
MuleSoft Mentor
Integral Zone
5. PAGE 5
- 2015 Company founded by ex-Oracle and ex-MuleSoft
employees
- Head quartered in the UK and offices in India and
Middle East
- MuleSoft/Salesforce services partner
- 50+ MuleSoft Services engagements
- 40+ customers including HSBC, Unilever, BP, NHS and
Roche
- 2019 Foray into Product development
- 4 Products in Dev Sec Ops and C4E space
About Integral Zone
5
7. What is a Transaction?
Transaction is a group of actions that should be performed as if they were a single "bulk" action.
● Atomicity
● Consistency
● Isolation
● Durability
7
8. Transaction Management in Mulesoft
Transactions in Mule are required when we have a series of processes in a flow that must succeed
completely or fail completely.
8
9. Single Resource Transactions
It only uses a single resource to send or receive messages: JMS broker, VM queues, or JDBC connections.
○ The example below illustrates a flow which includes a single resource transaction performed using the source
and publish operations of the JMS connector.
9
13. XA Transactions
Extended Architecture Transactions (or XA Transactions) can be used to group a series of operations from multiple
transactional resources, such as VM, JMS or Database, into a single reliable global transaction.
The XA protocol defines a 2-phase commit protocol which can be used to reliably coordinate and sequence a series
of atomic operations across multiple servers of different types.
13
19. Using Bitronix to Manage Transactions
Bitronix works on JTA (Java Transaction API) to perform global transactions , that is, transactions that access and
update data on two or more networked computer resources.
Bitronix Transaction Manager allows Mule to automatically recover interrupted transactions on restart.
It runs a recovery process to process any inflight transactions that were left abandoned during a instance crash or
connectivity issues.
19
20. Error Handling
When an error occurs during a transaction, your application must either handle the error and continue or perform a
rollback.
There are two types of error handlers, which behave differently when an error occurs during a transaction:
○ On Error Propagate
○ If the on-error-propagate error handler is inside the error-handler scope corresponding to the
component that began the transaction it will rollback the transaction if there is any error in the flow.
20
21. Error Handling
On Error Continue
The error is handled, the transaction remains active and is able to commit.
21
22. Use Case : Ecommerce Checkout
The upcoming use case is about a ecommerce checkout and payment process involving payment through
multiple payment methods (wallet and bank transactions), gift cards redemption and cash back.
Requirements:
➔ Debit customer’s wallet and account based on the chosen payment method.
➔ If wallet debit or bank call times out , retry the entire transaction again in the background and create the
order for the customer
➔ If wallet debit or bank call returns any error, rollback the transaction and return the error message.
➔ If redemption of the gift card or credit of wallet fails, retry in the background and commit the transaction.
22
25. Hitesh Joshi
Senior MuleSoft Consultant
Integral Zone
MuleSoft Code quality Analysis
Maintaining code quality in integration delivery
MuleSoft Meet up | Reading, United Kingdom
04th March, 2022
26. 26
⮚ What is Code Quality
⮚ Mulesoft Code Quality Tools
⮚ Deep dive into IZ Analyzer
⮚ Demo
⮚ Endnotes
Agenda
27. 27
What is Code Quality
Bug free
Security
Maintainability
Reusability
Complexity
Others
Peer Review
Quality
Code
• Everyone
• Security Team
• NW Team
• Architects
• Support Team
• Project Man
• Project Man
• Business
• Architect
• Project Man
• Project Man
• Business
28. 28
Mulesoft Code Quality Tools
Popular Mulesoft Code Quality Assessment Tools Available in the market
⮚ Mule-Sonar-Plugin
⮚ Mule-Lint
⮚ IZ Analyzer
29. 29
Mule-Sonar-Plugin
Mule-Sonar-Plugin is open source unlicensed project available in market which provides static code
analysis for Mulesoft projects. It leverages popular CQA platform SonarQube’s quality gates to do
validation of Mule code.
⮚ Open Source
⮚ No cost – free to use
⮚ Can scan multiple projects
⮚ Central view
⮚ Unlicensed – Not an official product.
⮚ Only static code analysis.
⮚ No plugin for Anypoint Studio
⮚ Comes with very few predefined Mule validation rules.
⮚ No thought leadership behind.
⮚ Since unlicensed – No support channel,
No guaranteed updates
Pros Cons
30. 30
Mule-Lint
Mule-Lint is another open source unlicensed project which was initiated by a few evangelist in
Mule space on Minimum Viable Product basis. This also provides static code analysis for Mule.
Pros Cons
⮚ Open Source
⮚ No cost – free to use
⮚ Light weighted
⮚ Unlicensed – Not an official product.
⮚ Only static code analysis.
⮚ No plugin for Anypoint Studio
⮚ All validation rules have to be defined .
⮚ No thought leadership behind.
⮚ Since unlicensed – No support channel,
No guaranteed updates
31. 31
IZ Analyzer – Deep Dive
IZ Analyser’s biggest edge compared to other two products for Mulesoft CQA is Anypoint Studio
plugin. It’s on-the-fly result set in studio shows real time code violations, enabling developers to
make their code compliant early in dev lifecycle saving lot of time.
⮚ Tailor-made for Mulesoft – Pre defined 180+ Mule validation rules.
⮚ Static Code Analysis – With DevOps plugin – WebView
⮚ Real-time Dynamic Code Analysis – Anypoint Studio Plugin
⮚ Ability to scan Non Mule – OAS API specs as well.
⮚ Enterprise grade license, support from Integral Zone.
32. 32
Deep dive – IZ Analyzer
How does it makes normal Muleys life easy?
⮚ Anypoint Studio Plugin.
⮚ Early code violation detection.
⮚ Predefined rules for Mule best practices.
⮚ Autofix and FixPreview feature at button clicks.
⮚ Custom rule creation.
⮚ DevOps integrated code scans.
⮚ Organisational web view.
⮚ Ability to scan non mule API specs as well.
33. 33
Deep dive – IZ Analyzer
⮚ Quick Demo - Anypoint Studio Plugin
▪ All connectors configs are not defined in global.xml
▪ Implementation should not be in auto generated file
▪ API Datatype - min and max length not defined for String datatype
34. 34
Mule CQA Tools Comparison
Features
Mule-Sonar-
Plugin
IZ Analyzer MuleLint
Purpose built for all Mule configuration files
(YAML, XML, RAML, OAS)
Anypoint Studio Plugin
Predefined Mule best practice rules
Central rules management for MuleSoft
Enterprise grade support
Auto Fix and FixPreview Feature
Custom Rule Creation – Studio Editor
Regular rules updates from product
Comprehensive central insight
Well documented use
37. 37
Quiz: Questions
1. In case there is no error handling defined and any failure happens during the
transaction, is the transaction rolled back or still committed?
2. Is it possible to set a transactional resource to skip and to not be a part of an in-
progress transaction ?
3. Does Munit support Sonar reports in Mule? If yes, with which version of Munit this
functionality was released? If not, what is the MuleSoft roadmap for this.
38. 38
Quiz: Answers
1. In case there is no error handling defined and any failure happens during the
transaction, is the transaction rolled back or still committed?
Transaction is rolled back. By default, Mule propagates an exception in the absence of
exception handling
2. Is it possible to set a transactional resource to skip and to not be a part of an in-
progress transaction ?
Yes, it is possible if we explicitly set the transaction action as “Not_Supported“
3. Does Munit support Sonar reports in Mule?
1. If yes, with which version of Munit this functionality was released?
Yes, it does.
2. If not, what is the MuleSoft roadmap for this.
MuleSoft has already included this and it is available from Munit version 2.3.0
onwards.
39. 39
Quick knowledge hacks
C4E
a. Video series: Accelerating C4E adoption
a. Video 1: Introduction
b. Video 2: Accelerators
c. Video 3: Code review
d. Video 4: DevSecOps
b. All C4E-related archive
IZ ANALYZER
a. Automate Mule Code reviews with IZ Analyzer: An Overview with Explanatory video
b. Technical Documentation about IZ Analyzer
40. 40
What next?
Try for free
IZ Analyzer and get your Code review results
instantly!
https://analyzer.integralzone.com/try
Participate in our Code Quality Reviews:
Annual Trend Survey 2022
https://survey.integralzone.com/zs/nhCCyE
Survey sample questions