3 Replies Latest reply on Mar 29, 2016 6:07 AM by mmusgrov

    How to enable RESTAT participants to participate in a JTA transaction running inside Tomcat?

    lin_jboss

      I have bean run a demo  restat with apache cxf inside tomcat. but only inbound bridge,how to  implement outbound bridge?

      is there any demo? please give me some suggestion

      thanks

       

       

        • 1. Re: How to enable RESTAT participants to participate in a JTA transaction running inside Tomcat?
          gytis

          Hi, Frank.

           

          We do not have outbound bridge implemented. So far we didn't have people interested in it, thus we didn't look into it.

          However, if there would be more interest we might add it into the future release.

          • 2. Re: How to enable RESTAT participants to participate in a JTA transaction running inside Tomcat?
            mmusgrov

            Although we do not provide an outbound bridge maybe an approach I posted on the resteasy email list could work for you. Suppose there are two web applications A and B whose work needs to be performed inside the same transaction:- A starts a JTA transaction and invokes REST endpoints in app B. To get the intended behaviour you could start a REST-AT transaction and then emulate what we do with the "inbound bridge" by manually starting a bridge before doing your JTA work. Something similar to:

             

            1. EJB in web app A will start a REST-AT transaction;
            2. EJB in web app A will start an InboundBridge (instead of the JTA transaction):
              1. InboundBridge inboundBridge = InboundBridgeManager.getInstance().createInboundBridge("enlistmentUrl from step 1");
              2. inboundBridge.start();
            3. EJB in web app A will perform JTA work (insert some records in a database, send JMS messages etc);
            4. invoke a REST endpoint in app B passing the enlistmentUrl in a Link header;
            5. mark up the REST endpoint in app B (using the javax.transaction.Transactional annotation) - this will automatically start an instance of the inbound bridge;
            6. commit the REST-AT transaction started in step 1. This will cause the work done in B and in A to commit within the context of the single REST-AT transaction.
            • 3. Re: How to enable RESTAT participants to participate in a JTA transaction running inside Tomcat?
              mmusgrov
              5. mark up the REST endpoint in app B (using the javax.transaction.Transactional annotation) - this will automatically start an instance of the inbound bridge;

              Note that step 5 is only required if REST app B also needs to perform JTA work.