Orchestration Transactions BizTalk by wajeeha713


									    Module 8
Creating Business
Module Overview

      Creating Transactions
      Adding Compensation and Handling Exceptions
Lesson: Creating Transactions

      Steps for Setting Up a Transaction
      Creating a Scope
      Creating an Atomic Transaction
      Creating a Long-Running Transaction
      Nesting Orchestrations
      Defining an Orchestration as Transactional
Steps for Setting up a Transaction

              1   Create a scope

              2   Identify the type of transaction required

              3   Determine the transaction to be compensated

              4   Identify potential errors

              5   Add appropriate exception handlers

              6   Define compensation code
Creating a Scope

                                              Long-Running Transaction

                                                    Loan application received
      Framework for organizing actions
      Used for transactional execution and
       exception handling
                                                           Request Credit Report
      Contains one or more blocks
      Can have appended exception-
       handling and compensation blocks                    Order Appraisal
      Can be synchronized or not

                                                                  Sign Documents
Creating an Atomic Transaction

  Atomic Transactions
     Guarantee rollback for transaction failures
     Use 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 a Long-Running Transaction

                                                Long-Running Transaction
  Long-running transactions
                                                      Loan Application Received
     Are transactions that must run for an
      extended time
     Use when ACID properties are not
     Data is not locked and can be modified                  Request Credit Report

     Individual steps are committed during
                                                              Order Appraisal
      the transaction
     The transaction itself is not committed
      until the last statement has completed
     Can be nested to provide atomic
      components                                                    Sign Documents
Nesting Orchestrations

         Call Orchestration                  Start Orchestration

                                           Invokes another orchestration
       Invokes another orchestration       asynchronously
        synchronously                      Calling orchestration continues
       Calling orchestration waits         processing
Defining an Orchestration as Transactional

Transactional orchestration
   Use to define an entire
    orchestration as transactional
   You can nest a long-running or
    atomic transaction within an
   You cannot nest a transactional
    scope within an orchestration that
    is not transactional
   Set the Transaction Type property
    to specify the transaction type for
    the orchestration
Demonstration: Creating Transactions

                     Creating an atomic transaction
                     Creating a long-running transaction
                     Defining an orchestration as transactional
Lesson: Adding Compensation and Handling Exceptions

      Adding Compensation Code
      Handling Exceptions
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

                                Debit Account A           Credit Account B

                                    Commit                    Commit

                   Compensation Code

                        Reverse Debit             Reverse Credit
Handling Exceptions

      Use to control orchestration errors
      BizTalk Server provides handling mechanisms

         Exception causes
                                                       Exception Error
            Throw Exception shape
            Time-out expiration              Catch exception block
            Transaction failure
            External user code failure               Error Report

            System exception
                                                     Error Handling
            External fault message
Demonstration: Adding Compensation and Exception Handling

                       Adding compensation code
                       Adding exception handling code
Best Practices

   Working with transactions
   1.   Compensation only runs for committed transactions
   2.   A long-running transaction commits each step when the step completes
   3.   An orchestration must be long-running to contain transactions
   4.   Make .NET objectives serializable or stateless
   5.   Dehydration never occurs during an atomic transaction
   6.   Catch the most specific exceptions first.

         Creating Transactions
         Adding Compensation and Exceptions
Lab: Creating Transactions

            Lab Exercises:
               Configure orchestration properties and variables for transactions
               Create and configure business transactions
               Build and deploy the orchestration transaction project
               Start and Test the Orchestration

To top