SlideShare a Scribd company logo
1 of 27
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_ architectureMauro Vocale
 
Transaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaTransaction and concurrency pitfalls in Java
Transaction and concurrency pitfalls in JavaErsen Ö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 managementHarshit Choudhary
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on TransactionRahul 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
 
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 PatternsElifTech
 
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
 
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
 
Transaction Processing System
Transaction Processing SystemTransaction Processing System
Transaction Processing SystemAbdul Aslam
 
Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6Monolithic to Microservices Architecture - STM 6
Monolithic to Microservices Architecture - STM 6Tricode (part of Dept)
 
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 ComputingWSO2
 
UNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsUNIT-IV: Transaction Processing Concepts
UNIT-IV: Transaction Processing ConceptsRaj 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 MuleSoftJitendra Bafna
 
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To TransactionsMongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals: Journey To TransactionsMydbops
 

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 NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор ТурскийThe working architecture of NodeJS applications, Виктор Турский
The working architecture of NodeJS applications, Виктор Турский
 
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 ...
 
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

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

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