cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrei Shakirin <ashaki...@talend.com>
Subject RE: JTA support for JMS Transport in CXF 3.0
Date Fri, 11 Apr 2014 11:56:10 GMT
Hi Christian,

Some comments inline:

> -----Original Message-----
> From: Christian Schneider [mailto:cschneider111@gmail.com] On Behalf Of
> Christian Schneider
> Sent: Donnerstag, 10. April 2014 10:39
> To: CXF Dev
> Subject: JTA support for JMS Transport in CXF 3.0
> 
> Hi All,
> 
> I am currently working on the transaction support (resource local and
> JTA) for the JMS transport in CXF 3.
> 
> In a chat with Dan we found that it is not fully clear what we expect from the
> transaction support. So I will do a coarse design here on the list and hope to get
> some feedback on what you expect and would like to see.
> 
> The general principle on kind of "container" managed transaction support is to
> open a transaction when a message is received. Then the message is processed
> inside the transaction. If an exception happens in the processing the transaction
> is rolled back and the JMS server tries some redeliveries. If these all fail the
> message goes to the dead letter queue. If the processing runs without an
> exception the transaction and so the message will be committed.

Generally speaking transactions can be used on receiving and on sending sides: if transaction
is successfully committed, all receiving messages are acknowledged and sending messages are
sent.
Basically it is possible to have some use case for transaction in case of sending messages
as well: 
- if user sends correlated messages in some different queues/topics and would like to keep
this atomic
- if user sends message first and write some data in DB afterwards and would like to keep
this atomic

But I agree that support transaction by receiving is the most important on the first step.

> 
> Service side:
> 
> - Support transactions only for One Way messaging. I think for request reply
> there is always a client on the other side who can retry when a message is lost
> and the client also wants some feedback about errors on the server side.

I see this the same as for previous topic: there are some uses cases for request-reply as
well, but seems that one way is the most important for now.
In case of supporting transactions for message sending, user should be especially careful
for request-reply: if he sends the message and then try to receive a reply to that message
in the same transaction, the code will hang until timeout, because the send cannot take place
until the transaction is committed.

> - For one way exchanges I propose to roll back on any exceptions as it is the
> simplest case. We might also support to permanently fail a message on things
> like invalid xml as this will probably also fail the next time. It is difficult to
> correctly specify when to roll back and when to fail in this case.

JEE supports following concept here:
1. All RuntimeException rollback the transaction
2. All checked exceptions declared with @ApplicationException(rollback=true) rollback the
transaction
By default checked application exceptions do not rollback the transaction.

For CXF I see two possibilities on the first step:
a) rollback transaction on all exceptions at all (like Christian proposed)
b) rollback transaction on runtime exceptions only
I tend currently to (a) and support something like @ApplicationException(rollback=true) in
the future.
WDYT?


> - I tested the low level MessageListenerContainer I created with resource local
> and JTA transactions. JTA only seems to work if I use a polling approach. I am
> not sure if this is expected.

I can look deeply on that.

> 
> Client Side:
> 
> - No special handling on conduit side

See the first comment: ok for now, can be extended for the future

> - If the user uses a JCA Pooling Connection Factory the session would
> automatically take part in any user transactions. For one way messaging this is
> probably a good thing. For request reply this is rather not what we want as the
> message would only be sent after the commit. As the conduit waits for the
> reply the message then would never be sent out and we run into a timeout.

Yep, I have pointed on this problem in second comment. Perhaps we should document this case
and suggest to user to decouple sending and receiving the messages in case of using JCA Pooling
Connection Factory.
I think we also be able to check this case in conduit and produce warning/error.

> 
> I would be happy to hear from you what you would expect from transaction
> support and what you think about the ideas formulated here. If any of you has
> first hand experience with JMS transactions (especially JTA) I would also like to
> hear from your experiences.
> 
> Christian

You did really amazing job with JMS, Christian!

Regards,
Andrei.

> 
> 
> --
> Christian Schneider
> http://www.liquid-reality.de
> 
> Open Source Architect
> http://www.talend.com


Mime
View raw message