You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Christian Schneider <ch...@die-schneider.net> on 2015/10/30 20:33:46 UTC

Redelivery not working

I am currently doing a demo for XA transactions that should show how to 
combine JMS and JPA in one transaction.

My code is at:
https://github.com/Talend/tesb-rt-se/tree/ebook-example/examples/tesb/ebook

I am pretty sure my setup for the XA Transactions is correct now. In my 
logs I see that JMS participates in the transaction and that the 
transaction is rolled back.
See
https://gist.github.com/cschneider/f44d5ea729379a6e19f7

I would expect that now ActiveMQ redelivers the message 3 times like I 
set it up. This does not seem to work though. For each redelivery I 
should get an exception and the rollback in camel but I only see it once.

This is my setup for the ConnectionFactory:
https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-connectionfactory/src/main/resources/OSGI-INF/blueprint/blueprint.xml

and this is my camel setup :
https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-importer/src/main/resources/OSGI-INF/blueprint/blueprint.xml

Any idea what I am doing wrong?

Christian


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Redelivery not working

Posted by Christian Schneider <ch...@die-schneider.net>.
The Bookrepository uses Aries JPA. The class is marked @Transactional. 
So it will start an XA transaction before each call or join one.

For the camel route that start with jms: the JMSComponent is injected 
with a PlatformTransactionManager. This causes camel to start a 
transaction before receiving each message
and commit or rollback when the route is finished. I also used the 
transacted() dsl which starts a (required) transaction but I am not sure 
if it is needed.

In any case the log I pasted shows that the XA transaction really 
happens (at least I hope so).

Christian


On 30.10.2015 20:58, Clebert Suconic wrote:
> What is the actual code doing XA? I look at the examples and I
> couldn't pinpoint one.
>
> On Fri, Oct 30, 2015 at 3:33 PM, Christian Schneider
> <ch...@die-schneider.net> wrote:
>> I am currently doing a demo for XA transactions that should show how to
>> combine JMS and JPA in one transaction.
>>
>> My code is at:
>> https://github.com/Talend/tesb-rt-se/tree/ebook-example/examples/tesb/ebook
>>
>> I am pretty sure my setup for the XA Transactions is correct now. In my logs
>> I see that JMS participates in the transaction and that the transaction is
>> rolled back.
>> See
>> https://gist.github.com/cschneider/f44d5ea729379a6e19f7
>>
>> I would expect that now ActiveMQ redelivers the message 3 times like I set
>> it up. This does not seem to work though. For each redelivery I should get
>> an exception and the rollback in camel but I only see it once.
>>
>> This is my setup for the ConnectionFactory:
>> https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-connectionfactory/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>>
>> and this is my camel setup :
>> https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-importer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>>
>> Any idea what I am doing wrong?
>>
>> 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


Re: Redelivery not working

Posted by Christian Schneider <ch...@die-schneider.net>.
Oh well ... got it working now. I did not inject the TransactionManager 
into the XaPooledConnectionFactory.
That took a while to figure out.

Christian

On 30.10.2015 23:32, Christian Schneider wrote:
> I tested with an external broker now and the message is consumed so it 
> is not rolled back at all.
> As I am quite sure the XA transaction happens and is rolled back my 
> assumption is that the ActiveMQXASession does not participate in the 
> transaction.
> I thought the bean 
> org.apache.activemq.jms.pool.ActiveMQResourceManager would do this but 
> maybe it does not work.
>
> Christian
>
>
> On 30.10.2015 20:58, Clebert Suconic wrote:
>> What is the actual code doing XA? I look at the examples and I
>> couldn't pinpoint one.
>>
>>
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Redelivery not working

Posted by Christian Schneider <ch...@die-schneider.net>.
I tested with an external broker now and the message is consumed so it 
is not rolled back at all.
As I am quite sure the XA transaction happens and is rolled back my 
assumption is that the ActiveMQXASession does not participate in the 
transaction.
I thought the bean org.apache.activemq.jms.pool.ActiveMQResourceManager 
would do this but maybe it does not work.

Christian


On 30.10.2015 20:58, Clebert Suconic wrote:
> What is the actual code doing XA? I look at the examples and I
> couldn't pinpoint one.
>
>

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Redelivery not working

Posted by Clebert Suconic <cl...@gmail.com>.
What is the actual code doing XA? I look at the examples and I
couldn't pinpoint one.

On Fri, Oct 30, 2015 at 3:33 PM, Christian Schneider
<ch...@die-schneider.net> wrote:
> I am currently doing a demo for XA transactions that should show how to
> combine JMS and JPA in one transaction.
>
> My code is at:
> https://github.com/Talend/tesb-rt-se/tree/ebook-example/examples/tesb/ebook
>
> I am pretty sure my setup for the XA Transactions is correct now. In my logs
> I see that JMS participates in the transaction and that the transaction is
> rolled back.
> See
> https://gist.github.com/cschneider/f44d5ea729379a6e19f7
>
> I would expect that now ActiveMQ redelivers the message 3 times like I set
> it up. This does not seem to work though. For each redelivery I should get
> an exception and the rollback in camel but I only see it once.
>
> This is my setup for the ConnectionFactory:
> https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-connectionfactory/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>
> and this is my camel setup :
> https://github.com/Talend/tesb-rt-se/blob/ebook-example/examples/tesb/ebook/ebook-importer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>
> Any idea what I am doing wrong?
>
> Christian
>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>



-- 
Clebert Suconic