5 Replies Latest reply on Apr 28, 2015 9:58 AM by Bruno Lacerda

    SwitchYard Remote Transaction Propagation - Simple Question

    Bruno Lacerda Newbie

      Hi,

       

      I'd like to know if it's possible to sinchronize in a remote SwitchYard client transaction (UserTransaction) started on JBoss EAP 6, with two distinct SCA invocations like a single transaction.

      The image below should clarify what I'm traing to explain.

      Scenario.png

      T0 - Transaction 0 - Been opened on a Servlet

      T1 - Transaction 1 - Opened on Switchyard Component Bean Service @Service

      T2 - Transaction 2 - Opened on Switchyard Component Bean Service @Service

       

      If SCA2 operation fails, I'd like to rollback SCA1 operation.

       

      On T0 (Client Side) I have:

       

      public class ClientSCAServlet extends HttpServlet {

           ...    

           public void service () {

                ...

                UserTransaction tx = (UserTransaction) new InitialContext().doLookup("java:jboss/UserTransaction");

                tx.begin();

                ...

                try {

                     remoteSCA1Invoker.invoke();

                     remoteSCA2Invoker.invoke();

                     ...

                     // I'm throwing an exception here to force rollback on SCA1 and SCA2

                } catch(Exception e) {

                     tx.setRollbackOnly();

                }

           }

      }

       

       

      The remote invocations are working fine but the rollback doesn't works and I don't know if it's possible.

       

      Thanks in advance and sorry for the english mistakes. ;-)

        • 1. Re: SwitchYard Remote Transaction Propagation - Simple Question
          Tomohisa igarashi Master

          Hi Bruno,

           

          You need to setup XTS to enable remote transaction propagation through remote SCA binding. Please take a look at the transaction-propagation demo (${SY_EAP_HOME}/quickstarts/demos/transaction-propagation) for more details. There are 2 config.cli in credit and dealer dir which setup XTS subsystem on EAP.

           

          hth,

          Tomo

          • 2. Re: SwitchYard Remote Transaction Propagation - Simple Question
            Bruno Lacerda Newbie

            Hi Tomo,

             

            first of all, thanks for reply.

             

            The config.cli includes the line below that doesn't works on JBoss EAP 6 server because EAP 6 doesn't have the SY subsystem:

             

            /subsystem=switchyard/module=org.switchyard.component.bpel:write-attribute(name=properties, value={bpel.xts.enable => true})

             

            So I removed this one, executed the script and got success outcome.

            On the SY server I executed the config.cli without changes (except the port) and also got the success outcome.

            Running my scenario after these changes, the transaction wasn't propagated and after rollback the transaction on JBoss EAP 6 side, al the persistent job made on SY side had been commited and not rolled back as expected.

            The transaction rollback works fine if the exception occurs on SY side, so the transaction propagation on SY side is OK.

             

            On the transaction-propagation demo, the transaction is propagated between SY servers, the remote client only makes a remote SCA invocation. This demo will works if the client is on an EAP 6 server and the transaction rollback starts after the remote SCA invocation on JBoss EAP 6 client side?

             

            Thanks in advance.

            • 3. Re: SwitchYard Remote Transaction Propagation - Simple Question
              Bruno Lacerda Newbie

              These are my SY dependencies installed on JBoss EAP 6 client application:

               

              <dependency>

                  <groupId>org.switchyard</groupId>

                  <artifactId>switchyard-remote</artifactId>

                  <version>1.1.1-p5-redhat-1</version>

                  <exclusions>

                      <exclusion>

                          <groupId>org.codehaus.jackson</groupId>

                          <artifactId>jackson-core-asl</artifactId>

                      </exclusion>

                  </exclusions>

              </dependency>

              <dependency>

                  <groupId>org.switchyard.components</groupId>

                  <artifactId>switchyard-component-sca</artifactId>

                   <version>1.1.1-p5-redhat-1</version>

              </dependency>

              <dependency>

                  <groupId>org.codehaus.jackson</groupId>

                  <artifactId>jackson-core-asl</artifactId>

                   <version>1.9.9-redhat-2</version>

              </dependency>

              • 4. Re: SwitchYard Remote Transaction Propagation - Simple Question
                Tomohisa igarashi Master

                So you mean the client side of application is not a SwitchYard application but just uses HttpInvoker to  invoke remote SwitchYard application? then the transaction is not propagated. The remote transaction propagation through the SCA binding works only if both side are SwitchYard application and uses SCA reference binding to invoke the other side.

                • 5. Re: SwitchYard Remote Transaction Propagation - Simple Question
                  Bruno Lacerda Newbie

                  Tomohisa igarashi escreveu:

                   

                  So you mean the client side of application is not a SwitchYard application but just uses HttpInvoker to  invoke remote SwitchYard application? then the transaction is not propagated. The remote transaction propagation through the SCA binding works only if both side are SwitchYard application and uses SCA reference binding to invoke the other side.

                  Yes Tomo,

                   

                  the client side is a simple JBoss EAP 6 Web Application that uses org.switchyard.remote.http.HttpInvoker to invoke remote SY Application.

                  Conclusion: In the described scenario, the transaction propagation will not work!

                   

                  Thank you so much for clarify my doubt and save much of my time trying the impossible :-)