160 likes | 287 Views
Module 10: Creating Transactional Business Processes. Overview. Lesson 1: Introduction to Transactions Lesson 2: Configuring Transactions. Lesson 1: Introduction To Transactions . What Are Transactions? What Is Instance Persistence? Persistence Points in an Orchestration
E N D
Overview • Lesson 1: Introduction to Transactions • Lesson 2: Configuring Transactions
Lesson 1: Introduction To Transactions • What Are Transactions? • What Is Instance Persistence? • Persistence Points in an Orchestration • Steps for Setting Up a Transaction
What Are Transactions? { } Transaction Types Atomic — provide rollback capabilities Long-running — save state at persistence points Scope Shape Framework for transactions Enables exception handling Enables compensation handling Scope Drop a shape from the toolbox here
What Is Instance Persistence? State Persistence Orchestration engine manages the persistence and restoration of orchestration service instances Critical when resources required by service instances are greater than resources available Persistence Functions Dehydration and rehydration Instance recovery Transaction compensation Controlled system shutdown
Persistence Points in an Orchestration Persistence Points Persistence Point Message sent within anon-atomic scope End of transactional scope Starting a new orchestration instance (Start Orchestration shape) Debug break point Dehydration Orchestration completes System shutdown Persist State MessageBox
Steps for Setting Up a Transaction Create a scope 1 Identify the type of transaction required 2 Determine if the transaction requires compensation 3 Identify potential errors 4 Add appropriate exception handlers 5 Define compensation code 6
Lesson 2: Configuring Transactions • Defining an Orchestration as Transactional • Creating a Long-Running Transaction • Creating an Atomic Transaction • Creating Modular Business Processes • Demonstration: Creating Transactions • Adding Compensation Code • Demonstration: Adding Compensation Code
Defining an Orchestration as Transactional Transactional orchestration Use to define an entire orchestration as transactional You can nest a long-runningor atomic transaction withina transactional orchestration You cannot nest a transactional scope within an orchestration that is not transactional Set the Transaction Type property to specify the transaction type forthe orchestration
Creating a Long-Running Transaction Long-running transactions Long-Running Transaction May run for an extended time Used when ACID properties arenot required Data is not locked and can be modified Individual steps are committed during the transaction The transaction itself is not committed until the last statement has completed Can be nested to provideatomic components Loan application received Request Credit Report Order Appraisal Sign Documents
Creating an Atomic Transaction Atomic Transactions Guarantee rollback for transaction failures Used when ACID properties are required Isolate state changes until committed Can set entire orchestration to atomic Atomic Transaction Debit Account A Credit Account B Commit Commit
Creating Modular Business Processes Invokes anotherorchestration synchronously Calling orchestration waits Invokes anotherorchestration asynchronously Calling orchestration continues processing Call Orchestration Start Orchestration
Demonstration: Creating Transactions In this demonstration, you will see how to: • Set an orchestration as transactional • Add a transactional scope toan orchestration • Add an exception handler to a scope
Adding Compensation Code Compensation code Can be used for long-running or atomic transactions Reverses the effects of a transaction Called after the transaction has been completed Uses default compensation for nested transactions Atomic Transaction Credit Account A Credit Account B Commit Commit Compensation Code Reverse Debit Reverse Credit
Demonstration: Adding Compensation Code In this demonstration, you will see how to: • Add a compensation block toa transaction
Lab: Creating Transactional Business Processes • Exercise 1: Adding Exception Handling to an Orchestration • Exercise 2: Adding Compensation to an Orchestration • Exercise 3: Calling Compensation • Exercise 4: Testing the Application