SlideShare a Scribd company logo
Saturday, 5th March,2022
Faridabad MuleSoft Meetup Group
Transaction Management in Mulesoft
2
1. Introductions
2.Transaction in MuleSoft
3.Managing transactions in Mule applications
4.Demarcate transaction boundaries in Mule applications
5.Identify resources that participate in transactions in Mule Applications
6.Demo
7.Managing transactions using the Saga pattern (Overview)
8.Quiz
9.Networking time
10.Next Event Announcement
Agenda
3
●About the organizer:
○ Amit Singh
○ Pankaj Goyal
●About the speaker:
○ Gaza Nand
Introductions
A SHOW OF HANDS:
Who is new to this Meetup?
4
About the speaker:
○ Gaza Nand
Introductions
A SHOW OF HANDS:
Who is new to this Meetup?
FARIDABAD INDIA CHAPTER
Transaction Management in Mulesoft
6
● In its narrow technical definition, a transaction is a grouping of operations that are guaranteed to all complete, or none
at all.
- Transaction implementation should achieve below ACID properties.
Atomicity : All changes to data are performed as if they are a single operation/unbreakable unit.
Consistency :Data is in a consistent state when a transaction starts and when it ends. Data integrity should be maintained.
Isolation : The intermediate state of a transaction is invisible to other transactions and each TX should be isolate.
Durability: After a transaction successfully completes, changes to data persist and are not undone.
Transaction in MuleSoft
● Transactions Category
- Automate ( Handled by Mulesoft )
- Manual (Handled by Customer ) Saga
Pattern
Local and
XA
● Transactions are operations in a Mule application for which the result cannot remain
indeterminate. In other words, where a series of steps in flow must succeed or fail as
one unit.
7
● Local Transaction
○ For example, a series of operations to one database connection
● Global (XA) Transaction
○ For example, a series of operations to one A series of operations between one or more (typically two) different (XA compatible) systems, such as two
different databases, or a database and a JMS server
Transaction Types
Local Transaction XA Transaction
Spanning across single resource Spanning across Multiple resource
All Operation must belong to same module Operations can belong to the same as well
different connectors.Based on 2PC algorithm
All connectors should use single config-ref Valid only on supported resources
Does not support nested Transactions Supports nested Transactions
8
● Database Module
○ All Operations
Transaction Supported Components/Modules
● JMS Module
○ On New Message
○ Publish
○ Consume
● VM Module
○ Listener
○ Publish
○ Consume
○ Publish consume
● TRY Scope
9
● Flow Level ( Event Source Level )
A transactional connector acting as an event source.
○ DB - On Table Row
○ VM - Listener
○ JMS - On New Message
Demarcating the beginning of a transaction
● Scope Level ( Processor Level)
○ Try Scope
10
Committed automatically at end of a
○ Flow
○ Try scope
○ On Error Continue scope
Demarcating the end of a transaction
● Rollback transaction
○ After a failure occurs in a transaction scope, but only if the error is
not handled in an On Error Continue scope.
○ On Error Propagate scope.
○ By throwing an error in a flow or in a Try scope using <raise-error>
11
Transactional Actions
Action Description Processor supports
ALWAYS_BEGIN Always start new TX Throw
exception if TX ongoing
JMS, VM and DB connectors
(listeners only) and Try scope
ALWAYS_JOIN Always participate in ongoing
TX Throw exception if no
ongoing TX
JMS, VM and DB connectors (non-
listeners operations)
BEGIN_OR_JOIN Participate in ongoing TX Start
new TX if no ongoing TX
Try scope
JOIN_IF_POSSIBLE Participate in ongoing TX Do
not start a new TX if no
ongoing TX
JMS, VM, and DB connectors (non-
listeners operations)
INDIFFERENT Never participate in TX Ignore
any ongoing TX
Try scope
NONE Do not initiate a transaction. JMS, VM, and DB connectors
(listeners only)
Not Supported Execute outside any existent
transaction. It does not have
transactional behavior.
Operations that support transactions
A Transactional Action defines the type of action that operations take regarding transactions.
12
● Bitronix Transaction Manager allows Mule to automatically recover interrupted transactions
on restart.
● Bitronix is available as the XA transaction manager for Mule applications.
● To use Bitronix, declare it as a global configuration element in the Mule application.
● Each Mule runtime can have only one instance of a Bitronix transaction manager, which is
shared by all Mule applications.
● For customer-hosted deployments, define the XA transaction manager in a Mule domain
– Then share this global element among all Mule applications in the Mule runtime
Transaction Manager (Bitronix)
13
Transaction Manager (Bitronix)
Demo
15
● Saga pattern is an alternative to XA when resources are not XA-capable or XA is undesired.
○ For instance, API invocations
○ A way to achieve reliability that does not have ACID guarantees
Managing transactions using the Saga pattern
● Features of the Saga pattern include
○ Maintains consistency (but not atomicity) across multiple services without requiring a
transaction manager system
○ Uses a sequence of local TXs
○ Failure of a local TX executes a series of compensating transactions to undo the previous
successful TXs
○ More complex programming model compared with XA resources
16
● Event/Choreography pattern.
○ The service executes the transaction (TX) and publishes an event to be used by the next service
Types to implement Saga patterns
● Orchestration pattern
○ Saga orchestrator communicates with each service using a reply style.
○ The orchestrator logic can be modeled as a state machine
○ Similar to an XA pattern, the orchestrator coordinates transactions
• But does not require an XA-capable transaction manager nor resource managers.
17
Example: Saga Event/Choreography pattern
18
Example: Saga Command/Orchestration pattern
Quiz
1) VM,DB,AMQ
2) JMS,DB,FILE
3) DB,JMS,VM
4) JMS,VM,HTTP
What are different types of Transaction
Supported Components/Modules in MuleSoft
1) Dedicated
2) GRIZZLY
3) UBER
4) All of Above
What is the default Mule Runtime (scheduler
pool) thread pool type after 4.3.X version used
for mule application.
1) Single Resource and eXtended Architecture
2) Automate and Manual
3) Orchestration and Orchestration pattern
4) All of above
What type of transactions are handled by
MuleSoft only.
1) BEGIN_OR_JOIN
2) ALWAYS_BEGIN
3) ALWAYS_JOIN
4) JOIN_IF_POSSIBLE
Begin a TX at Flow Level by selecting which
appropriate action.
1) YES
2) NO
When Async scope running within a
transaction, if any error produced inside an
Async scope does it result in a rollback.
25
● Be a Helping Hand
○ Contact the Meetup Organizers if you want to be Speaker in upcoming events
○ Use https://meetups.mulesoft.com/faridabad/ link to contact to Organizers
● Share:
○ Tweet using the hashtag #MuleSoftMeetups #FaridabadMeetup #MuleSoft
#MuleMeetup
○ Invite your network to join: https://meetups.mulesoft.com/faridabad/
● 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

Similar to MuleSoft Meetup: Transaction Management

Saga transactions msa_ architecture
Saga transactions msa_ architectureSaga transactions msa_ architecture
Saga transactions msa_ architecture
Mauro Vocale
 
Transaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaTransaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in Java
Ersen Öztoprak
 
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JSFestUA
 
Spring transaction management
Spring transaction managementSpring transaction management
Spring transaction management
Harshit Choudhary
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on Transaction
Rahul Prajapati
 
'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...
OdessaJS Conf
 
Micro Services Intro
Micro Services IntroMicro Services Intro
Micro Services Intro
Alex Apollonsky
 
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
Fwdays
 
Domain Logic Patterns
Domain Logic PatternsDomain Logic Patterns
Domain Logic Patterns
ElifTech
 
Transition scope
Transition scopeTransition scope
Transition scope
Nadimozzaman Pappo
 
The working architecture of node js applications open tech week javascript ...
The working architecture of node js applications   open tech week javascript ...The working architecture of node js applications   open tech week javascript ...
The working architecture of node js applications open tech week javascript ...
Viktor Turskyi
 
The working architecture of NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор ТурскийThe working architecture of NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор Турский
Sigma Software
 
Transaction Processing System
Transaction Processing SystemTransaction Processing System
Transaction Processing System
Abdul Aslam
 
Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6
Tricode (part of Dept)
 
Megastore by Google
Megastore by GoogleMegastore by Google
Megastore by Google
Ankita Kapratwar
 
Multi-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud ComputingMulti-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud Computing
WSO2
 
UNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsUNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing Concepts
Raj vardhan
 
MuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoft
MuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoftMuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoft
MuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoft
Jitendra Bafna
 
Spring transaction part4
Spring transaction   part4Spring transaction   part4
Spring transaction part4
Santosh Kumar Kar
 
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To TransactionsMongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To Transactions
Mydbops
 

Similar to MuleSoft Meetup: Transaction Management (20)

Saga transactions msa_ architecture
Saga transactions msa_ architectureSaga transactions msa_ architecture
Saga transactions msa_ architecture
 
Transaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaTransaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in Java
 
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
 
Spring transaction management
Spring transaction managementSpring transaction management
Spring transaction management
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on Transaction
 
'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...'How to build efficient backend based on microservice architecture' by Anton ...
'How to build efficient backend based on microservice architecture' by Anton ...
 
Micro Services Intro
Micro Services IntroMicro Services Intro
Micro Services Intro
 
Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"Viktor Turskyi "Effective NodeJS Application Development"
Viktor Turskyi "Effective NodeJS Application Development"
 
Domain Logic Patterns
Domain Logic PatternsDomain Logic Patterns
Domain Logic Patterns
 
Transition scope
Transition scopeTransition scope
Transition scope
 
The working architecture of node js applications open tech week javascript ...
The working architecture of node js applications   open tech week javascript ...The working architecture of node js applications   open tech week javascript ...
The working architecture of node js applications open tech week javascript ...
 
The working architecture of NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор ТурскийThe working architecture of NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор Турский
 
Transaction Processing System
Transaction Processing SystemTransaction Processing System
Transaction Processing System
 
Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6
 
Megastore by Google
Megastore by GoogleMegastore by Google
Megastore by Google
 
Multi-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud ComputingMulti-Tenant SOA Middleware for Cloud Computing
Multi-Tenant SOA Middleware for Cloud Computing
 
UNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsUNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing Concepts
 
MuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoft
MuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoftMuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoft
MuleSoft Nashik Meetup#7 - Building FHIR applications in MongoDB using MuleSoft
 
Spring transaction part4
Spring transaction   part4Spring transaction   part4
Spring transaction part4
 
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To TransactionsMongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To Transactions
 

Recently uploaded

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 

Recently uploaded (20)

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 

MuleSoft Meetup: Transaction Management

  • 1. Saturday, 5th March,2022 Faridabad MuleSoft Meetup Group Transaction Management in Mulesoft
  • 2. 2 1. Introductions 2.Transaction in MuleSoft 3.Managing transactions in Mule applications 4.Demarcate transaction boundaries in Mule applications 5.Identify resources that participate in transactions in Mule Applications 6.Demo 7.Managing transactions using the Saga pattern (Overview) 8.Quiz 9.Networking time 10.Next Event Announcement Agenda
  • 3. 3 ●About the organizer: ○ Amit Singh ○ Pankaj Goyal ●About the speaker: ○ Gaza Nand Introductions A SHOW OF HANDS: Who is new to this Meetup?
  • 4. 4 About the speaker: ○ Gaza Nand Introductions A SHOW OF HANDS: Who is new to this Meetup?
  • 5. FARIDABAD INDIA CHAPTER Transaction Management in Mulesoft
  • 6. 6 ● In its narrow technical definition, a transaction is a grouping of operations that are guaranteed to all complete, or none at all. - Transaction implementation should achieve below ACID properties. Atomicity : All changes to data are performed as if they are a single operation/unbreakable unit. Consistency :Data is in a consistent state when a transaction starts and when it ends. Data integrity should be maintained. Isolation : The intermediate state of a transaction is invisible to other transactions and each TX should be isolate. Durability: After a transaction successfully completes, changes to data persist and are not undone. Transaction in MuleSoft ● Transactions Category - Automate ( Handled by Mulesoft ) - Manual (Handled by Customer ) Saga Pattern Local and XA ● Transactions are operations in a Mule application for which the result cannot remain indeterminate. In other words, where a series of steps in flow must succeed or fail as one unit.
  • 7. 7 ● Local Transaction ○ For example, a series of operations to one database connection ● Global (XA) Transaction ○ For example, a series of operations to one A series of operations between one or more (typically two) different (XA compatible) systems, such as two different databases, or a database and a JMS server Transaction Types Local Transaction XA Transaction Spanning across single resource Spanning across Multiple resource All Operation must belong to same module Operations can belong to the same as well different connectors.Based on 2PC algorithm All connectors should use single config-ref Valid only on supported resources Does not support nested Transactions Supports nested Transactions
  • 8. 8 ● Database Module ○ All Operations Transaction Supported Components/Modules ● JMS Module ○ On New Message ○ Publish ○ Consume ● VM Module ○ Listener ○ Publish ○ Consume ○ Publish consume ● TRY Scope
  • 9. 9 ● Flow Level ( Event Source Level ) A transactional connector acting as an event source. ○ DB - On Table Row ○ VM - Listener ○ JMS - On New Message Demarcating the beginning of a transaction ● Scope Level ( Processor Level) ○ Try Scope
  • 10. 10 Committed automatically at end of a ○ Flow ○ Try scope ○ On Error Continue scope Demarcating the end of a transaction ● Rollback transaction ○ After a failure occurs in a transaction scope, but only if the error is not handled in an On Error Continue scope. ○ On Error Propagate scope. ○ By throwing an error in a flow or in a Try scope using <raise-error>
  • 11. 11 Transactional Actions Action Description Processor supports ALWAYS_BEGIN Always start new TX Throw exception if TX ongoing JMS, VM and DB connectors (listeners only) and Try scope ALWAYS_JOIN Always participate in ongoing TX Throw exception if no ongoing TX JMS, VM and DB connectors (non- listeners operations) BEGIN_OR_JOIN Participate in ongoing TX Start new TX if no ongoing TX Try scope JOIN_IF_POSSIBLE Participate in ongoing TX Do not start a new TX if no ongoing TX JMS, VM, and DB connectors (non- listeners operations) INDIFFERENT Never participate in TX Ignore any ongoing TX Try scope NONE Do not initiate a transaction. JMS, VM, and DB connectors (listeners only) Not Supported Execute outside any existent transaction. It does not have transactional behavior. Operations that support transactions A Transactional Action defines the type of action that operations take regarding transactions.
  • 12. 12 ● Bitronix Transaction Manager allows Mule to automatically recover interrupted transactions on restart. ● Bitronix is available as the XA transaction manager for Mule applications. ● To use Bitronix, declare it as a global configuration element in the Mule application. ● Each Mule runtime can have only one instance of a Bitronix transaction manager, which is shared by all Mule applications. ● For customer-hosted deployments, define the XA transaction manager in a Mule domain – Then share this global element among all Mule applications in the Mule runtime Transaction Manager (Bitronix)
  • 14. Demo
  • 15. 15 ● Saga pattern is an alternative to XA when resources are not XA-capable or XA is undesired. ○ For instance, API invocations ○ A way to achieve reliability that does not have ACID guarantees Managing transactions using the Saga pattern ● Features of the Saga pattern include ○ Maintains consistency (but not atomicity) across multiple services without requiring a transaction manager system ○ Uses a sequence of local TXs ○ Failure of a local TX executes a series of compensating transactions to undo the previous successful TXs ○ More complex programming model compared with XA resources
  • 16. 16 ● Event/Choreography pattern. ○ The service executes the transaction (TX) and publishes an event to be used by the next service Types to implement Saga patterns ● Orchestration pattern ○ Saga orchestrator communicates with each service using a reply style. ○ The orchestrator logic can be modeled as a state machine ○ Similar to an XA pattern, the orchestrator coordinates transactions • But does not require an XA-capable transaction manager nor resource managers.
  • 19. Quiz
  • 20. 1) VM,DB,AMQ 2) JMS,DB,FILE 3) DB,JMS,VM 4) JMS,VM,HTTP What are different types of Transaction Supported Components/Modules in MuleSoft
  • 21. 1) Dedicated 2) GRIZZLY 3) UBER 4) All of Above What is the default Mule Runtime (scheduler pool) thread pool type after 4.3.X version used for mule application.
  • 22. 1) Single Resource and eXtended Architecture 2) Automate and Manual 3) Orchestration and Orchestration pattern 4) All of above What type of transactions are handled by MuleSoft only.
  • 23. 1) BEGIN_OR_JOIN 2) ALWAYS_BEGIN 3) ALWAYS_JOIN 4) JOIN_IF_POSSIBLE Begin a TX at Flow Level by selecting which appropriate action.
  • 24. 1) YES 2) NO When Async scope running within a transaction, if any error produced inside an Async scope does it result in a rollback.
  • 25. 25 ● Be a Helping Hand ○ Contact the Meetup Organizers if you want to be Speaker in upcoming events ○ Use https://meetups.mulesoft.com/faridabad/ link to contact to Organizers ● Share: ○ Tweet using the hashtag #MuleSoftMeetups #FaridabadMeetup #MuleSoft #MuleMeetup ○ Invite your network to join: https://meetups.mulesoft.com/faridabad/ ● 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?
  • 26. Introduce yourself to your neighbor Networking time