-
1. Re: how to provide custom transaction service for weld se embedded container
bmajsak Aug 29, 2013 6:03 AM (in response to matlach)Hi Mathieu,
I think Transaction Extension might be a good fit here. There is a SPI which you can use to provide your own implementation (in this case weld se embedded). I used this SPI for implementing JTA transaction support. It's quite simple, you literally need just 4 classes:
- TransactionProvider implementation where you implement delegate methods controlling the transaction execution
- Archive appender where you create your extension jar which will be bundled together with other Arquillian libraries for container deployment
- Client side extension configuration where you simply register your archive appender
- Remote extension configuration where you define your transaction provider through SPI mechanism
- Last but not least you should do SPI registration for client-side extension to enable extension for Arquillian tests
If you have any other questions I will be happy to help.
Cheers,
Bartosz
-
2. Re: Re: how to provide custom transaction service for weld se embedded container
matlach Aug 29, 2013 9:07 PM (in response to bmajsak)Thanks Bartosz for your detailed answer though I do not think this is working.
I followed closely your process but I still get this output when running my application with Arquillian:
32f43605-5049-4faf-a105-f7fb34563e0a.jar: /META-INF/ /META-INF/beans.xml /META-INF/services/ /META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension /org/ /org/atinject/ /org/atinject/arquillian/ /org/atinject/arquillian/ServiceA.class /org/atinject/arquillian/InMemoryTransactionProvider.class /org/atinject/arquillian/InMemoryTransactionArchiveAppender.class /org/atinject/arquillian/InMemoryTransactionRemoteExtension.class /org/atinject/arquillian/ServiceATest.class /org/atinject/arquillian/InMemoryTransactionExtension.class [main] INFO org.jboss.weld.Version - WELD-000900 2.0.3 (Final) [main] INFO org.jboss.weld.Bootstrap - WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
The transaction SPI of Arquillian (TransactionProvider) seem somewhat different of the Weld transaction SPI "TransactionServices".
I have started another thread on the Weld forum here.
The more I think of it, the more I am thinking this is a Weld issue;
I would expect Weld to be able to automatically discover provided "Services" through standard java ServiceLoader mechanism and / or by either defining some system properties.
By looking at WeldBootstrap and WeldStartup, this seem not feasible.
Any other ideas ?
Thanks again,
-
3. Re: Re: how to provide custom transaction service for weld se embedded container
bmajsak Aug 30, 2013 11:03 AM (in response to matlach)If you could share your code through GitHub I can have a look at it soon.
Cheers.
-
4. Re: Re: how to provide custom transaction service for weld se embedded container
matlach Sep 20, 2013 10:09 PM (in response to bmajsak)Sorry Bartosz for the late reply.
This is a Weld issue, I have opened the following enhancement request :
Feel free to vote for it.
Thanks,