2 Replies Latest reply on Jul 23, 2012 9:46 PM by Tomohisa igarashi

    Transaction Policy: Stage2

    Tomohisa igarashi Master

      Now I'm struggling with https://issues.jboss.org/browse/SWITCHYARD-748

       

      Code

       

      What I have done so far

      • Added 3 more intents according to SCA Policy spec - "managedTransaction.global", "managedTransaction.local" and "noManagedTransaction"
      • Added 1 original intent - "propagatesOrCreatesTransaction"
      • Clarified the runtime-specific behavior (the behavior when policy is absent. see table below)

       

      Transaction behavior

       

      Interaction PolicyImplementation PolicyTransaction ProvidedResult
      <absent><any><any>Propagates transaction if exists, otherwise does nothing
      propagatesTransactionmanagedTransaction.global or <absent>yesPropagates transaction
      propagatesTransactionmanagedTransaction.global or <absent>noRaise an error (unlike spec)
      propagatesTransactionmanagedTransaction.local or noManagedTransaction<any>Raise an error
      propagatesOrCreatesTransactionmanagedTransaction.global or <absent>yesPropagates transaction
      propagatesOrCreatesTransactionmanagedTransaction.global or <absent>noCreates new transaction, and completes it after invocation
      propagatesOrCreatesTransactionmanagedTransaction.local or noManagedTransaction<any>Raise an error
      suspendsTransactionmanagedTransaction.globalyesSuspends existing transaction and creates new one. After invocation, complete the transaction created, and then resume the original transaction
      suspendsTransactionmanagedTransaction.globalnoCreates new transaction, and completes it after invocation
      suspendsTransactionmanagedTransaction.localyes

      Suspends existing transaction and creates new one. After invocation, complete the transaction created, and then resume the original transaction

      suspendsTransactionmanagedTransaction.localno

      Creates new transaction, and completes it after invocation

      suspendsTransactionnoManagedTransaction or <absent>yes

      Suspends existing transaction and resumes it after invocation

      suspendsTransactionnoManagedTransaction or <absent>no

      Does nothing

       

      What should be done

      • In the case of managedTransaction.local, we need to guarantee that the service invocation doesn't propagate transaction to the outbound
      • Implement reference interaction policy processing
      • Create demo application

       

      I'm looking forward to seeing your advice

       

      Thanks,

      Tomo

        • 1. Re: Transaction Policy: Stage2
          Keith Babo Master

          Thanks for putting this together, Tomo.  I think this is a great way to capture the various scenarios.

           

          Added #s to your table for reference.  I'm not sure what is meant by "Transaction Provided" in this table.  Does this mean a transaction already exists, will exist after being created, ...?  I'm going to ignore that and just comment on the result field.

           

          For #3, we can create a transaction if the implementation policy is specified and keep the existing behavior if it's absent.  That will keep things backward compatible and spec compatible.  IINM, this also eliminates the need for 5-7.

           

           

           

          # Interaction PolicyImplementation PolicyTransaction ProvidedResult
          1<absent><any><any>Propagates transaction if exists, otherwise does nothing
          2propagatesTransactionmanagedTransaction.global or <absent>yesPropagates transaction
          3propagatesTransactionmanagedTransaction.global or <absent>noRaise an error (unlike spec)
          4propagatesTransactionmanagedTransaction.local or noManagedTransaction<any>Raise an error
          5propagatesOrCreatesTransactionmanagedTransaction.global or <absent>yesPropagates transaction
          6propagatesOrCreatesTransactionmanagedTransaction.global or <absent>noCreates new transaction, and completes it after invocation
          7propagatesOrCreatesTransactionmanagedTransaction.local or noManagedTransaction<any>Raise an error
          8suspendsTransactionmanagedTransaction.globalyesSuspends existing transaction and creates new one. After invocation, complete the transaction created, and then resume the original transaction
          9suspendsTransactionmanagedTransaction.globalnoCreates new transaction, and completes it after invocation
          10suspendsTransactionmanagedTransaction.localyes

          Suspends existing transaction and creates new one. After invocation, complete the transaction created, and then resume the original transaction

          11suspendsTransactionmanagedTransaction.localno

          Creates new transaction, and completes it after invocation

          12suspendsTransactionnoManagedTransaction or <absent>yes

          Suspends existing transaction and resumes it after invocation

          13suspendsTransactionnoManagedTransaction or <absent>no

          Does nothing

          • 2. Re: Transaction Policy: Stage2
            Tomohisa igarashi Master

            Thanks Keith,

             

            I'm not sure what is meant by "Transaction Provided" in this table.  Does this mean a transaction already exists, will exist after being created, ...?  I'm going to ignore that and just comment on the result field.

            I meant the transaction exists before TransactionHandler creates.

             

            For #3, we can create a transaction if the implementation policy is specified and keep the existing behavior if it's absent.  That will keep things backward compatible and spec compatible.  IINM, this also eliminates the need for 5-7.

            That's great idea! updated the table.

             

             

            # Interaction PolicyImplementation Policy

            Transaction Exists

            Result
            1<absent><any>yesPropagates transaction
            2<absent><any>nodoes nothing
            3propagatesTransaction<absent>yesPropagates transaction
            4propagatesTransaction<absent>noRaise an error
            5propagatesTransactionmanagedTransaction.globalyesPropagates transaction
            6propagatesTransactionmanagedTransaction.globalnoTransactionHandler creates new transaction, and completes it after invocation
            7propagatesTransactionmanagedTransaction.local or noManagedTransaction<any>Raise an error
            8suspendsTransactionmanagedTransaction.globalyesTransactionHandler suspends existing transaction and creates new one. After invocation, complete the transaction created, and then resume the original transaction
            9suspendsTransactionmanagedTransaction.globalnoTransactionHandler creates new transaction, and completes it after invocation
            10suspendsTransactionmanagedTransaction.localyes

            TransactionHandler suspends existing transaction and creates new one. After invocation, complete the transaction created, and then resume the original transaction

            11suspendsTransactionmanagedTransaction.localno

            TransactionHandler creates new transaction, and completes it after invocation

            12suspendsTransactionnoManagedTransaction or <absent>yes

            TransactionHandler suspends existing transaction and resumes it after invocation

            13suspendsTransactionnoManagedTransaction or <absent>no

            Does nothing

             

            Obviously better than before