Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Message-Driven Bean and Transaction  RSS feed

 
Cainiao Zou
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!