4 Replies Latest reply on Oct 1, 2014 2:41 AM by Ove Ranheim

    Custom TransactionServices in Weld 2.2.x

    Ove Ranheim Novice

      Hi,

       

      I'd like to register my own TransactionServices implementation (custom NarayanaTransactionServices). Is there a way to register this in Weld, so it would be loaded during WeldBoostrap startup? (https://github.com/stuartwdouglas/weld-core/blob/master/impl/src/main/java/org/jboss/weld/bootstrap/WeldStartup.java#L205)

       

      Here's another example using Bitronix: https://developer.jboss.org/message/848326#848326

       

      PS! I'm also using DeltaSpike 1.0.3

       

      Br, Ove

        • 1. Re: Custom TransactionServices in Weld 2.2.x
          Martin Kouba Master

          Hi Ove,

          TransactionServices is a per-deployment service so you would have to make your custom implementation available through the deployment SPI, i.e. org.jboss.weld.bootstrap.spi.Deployment.getServices(). What's the target environment? I mean this is rather an integrator issue.

          1 of 1 people found this helpful
          • 2. Re: Custom TransactionServices in Weld 2.2.x
            Ove Ranheim Novice

            Hei Martin

             

            The target environement is Weld EE and Weld Servlet/Tomcat 7 Embedded in conjunction with Arquillian.

             

            Is it possible to register (provide an SPI) so Weld EE or Weld Servlet would pick up my custom transaction service?

             

            Cheers
            Ove

            • 3. Re: Custom TransactionServices in Weld 2.2.x
              Martin Kouba Master

              Weld SE - yes, extend org.jboss.weld.environment.se.Weld, override the createDeployment() method, delegate to super, and add custom transactions service to the deployment

              Weld Servlet - not right now, please create an issue

              Weld in a Java EE container -  it's only possible if an integrator allows to override the default implementation (note that TransactionServices is required for EE containers)

              • 4. Re: Custom TransactionServices in Weld 2.2.x
                Ove Ranheim Novice

                There is an issues filed already: WELD-1495.

                 

                I would like to see an SPI so it'd be possible to have my custom transaction services loaded in WeldSE/EmbeddedEE and Weld-Servlet (for use in ie. Tomcat). It should not be necessary to write and maintain my own (integration) implementation for doing so. Really hope this issues will be addressed, so I can test my Entity Beans with JTA support in WeldSE, and playing around with the Naryana JTA.

                 

                Thanks Martin for pointing me into the right direction. I'll look into your workaround.