Hey Christian,

I had a look at your code and I think you need to grab the
XaConnectionFactory from the OSGi Service Registry (or create one).

Not sure if you're using ServiceMix or not, but here is how SMX makes these
services available in the container:
https://git-wip-us.apache.org/repos/asf?p=servicemix.git;a=blob;f=activemq/activemq-service/src/main/resources/OSGI-INF/blueprint/activemq-service.xml
.

Regards,

*Raúl Kripalani*
PMC & Committer @ Apache Ignite, Apache Camel | Integration, Big Data and
Messaging Engineer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Fri, Oct 30, 2015 at 4:58 PM, Christian Schneider <
ch...@die-schneider.net> wrote:

> I have now added more logging and see that I indeed have a JTA transaction
> and it seems to include the receive of the jms message.
> I also see that the transaction is rolled back when the error happens. So
> the only thing missing seems to be the redelivery. Any idea why that can
> happen?
>
> Christian
>
> On 30.10.2015 15:37, Raul Kripalani wrote:
>
>> Hi Christian,
>>
>> You need to plug in the JTA TransactionManager into the JMS consumer, so
>> that the transaction is opened as part of the consumption.
>>
>> Otherwise, the transaction starts after the route kicks off and therefore
>> doesn't cover the JMS consumption itself.
>>
>> Maybe this resource helps:
>>
>> https://access.redhat.com/documentation/en-US/Fuse_ESB_Enterprise/7.0/html/EIP_Transactions_Guide/XaJms-Overview.html
>>
>> Raúl.
>> On 30 Oct 2015 14:31, "Christian Schneider" <ch...@die-schneider.net>
>> wrote:
>>
>> I am trying to set up a route that spans an XA transaction from a jms
>>> endpoint to a db based endpoint or to another JMS endpoint.
>>>
>>> If I do a route like this:
>>> from("jms:queue1").transacted().to("jms:queue2")
>>>
>>> Will the transaction then also include the receive of the JMS message?
>>>
>>> I have set up an example at:
>>>
>>> https://github.com/Talend/tesb-rt-se/tree/ebook-example/examples/tesb/ebook
>>>
>>> The route is at
>>>
>>>
>>> https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-importer/src/main/java/org/talend/esb/examples/ebook/importer/ImportRoutes.java
>>> and the blueprint is here
>>>
>>>
>>> https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-importer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>>>
>>> I have implemented the BookRepository using Aries JPA and it supports XA
>>> transactions. For the test I throw an exception if the book title is
>>> "error1".
>>> I see the exception in camel but the message does not seem to be returned
>>> to the broker and I see no redelivery.
>>>
>>> I configured the ConnectionFactory like this:
>>>
>>>
>>> https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-connectionfactory/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>>>
>>> Any idea what I am doing wrong? Or do I misunderstand the concept of
>>> transactional routes in camel and this simply can not work?
>>> Can I debug the transaction handling somehow?
>>>
>>> Christian
>>>
>>> --
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>>
>>> Open Source Architect
>>> http://www.talend.com
>>>
>>>
>>>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>

Reply via email to