| Author |
Message-Driven Bean and Transaction
|
Cainiao Zou
Ranch Hand
Joined: Mar 03, 2009
Posts: 36
|
|
Hi, i'm reading a description about transaction in MDB (the book "Enterprise JavaBeans 3.0" from O'Reilly)
In my opinion, in MDB we shouldn't use the transaction attribute which has a relation with caller/client, because MDB is "message driven", so we just lost some informations about the client. And that's what it should be.
But why Required transaction attribute is allowed here? It will use the old transaction of client if there is one, am I right? And why not RequiredNew, it just create a new transaction no matter the situation of the client.
Is that an error of this book or i don't understand correctly?
thanks
|
 |
Piotr Nowicki
Ranch Hand
Joined: Jul 13, 2010
Posts: 610
|
|
Howdy Cainiao!
I don't think that the transactions in MDB means a transaction between a client/producer and consumer.
The main point of MDB and messaging is to decouple the sender from the receiver, so connecting/synchronizing their transactions is not a valid approach.
I rather think that the MDB transactions take place between a broker (JMS provider) and consumer.
Cheers!
|
OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8146
|
|
Pedro Kowalski wrote:
I rather think that the MDB transactions take place between a broker (JMS provider) and consumer.
The transaction for a MDB starts from the point the message is delivered to it and spans till the onMessage method completes.
|
[My Blog] [JavaRanch Journal]
|
 |
 |
|
|
subject: Message-Driven Bean and Transaction
|
|
|