• Post Reply Bookmark Topic Watch Topic
  • New Topic

Should I always separate logic from MessageDrivenBean?  RSS feed

 
Cainiao Zou
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In compare with Stateless Session Bean (SLSB), there are many limitations on MesageDrivenBean (MDB). I met a problem now:

In the onMessage function of my MDB, I do some job about Database (with help of a SLSB DAO, TransactionType is Require), after that I send the reponse message back. But I got a problem because I try to update database and send message in the same tranaction, which should be two-phase commit. I use HSQLDB inside JBoss, it doesn't support the two-phase commit. So I have to separate the database operation and send message operation in two different transaction. The question is how?

Should I make another SLSB, only for sending message? Or I have to change the TransactionType of DAO to Require_New?
Is there any better solution?

thanks.
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I have to change the TransactionType of DAO to Require_New?

I dont see what else you can do. Be reminded that a rollback of the outer transaction will not undo the commits made by the inner one. So you may have to manually compensate for the changes by the dao if the msg sending from within the mdb failed.

cheers.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!