Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of MDBs for sending EMails

 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

At present i am Using Session Bean for sending Emails, in my application. This session Bean is not part of any transactions. Sending Emails sometimes takes lot of time, will it be a good idea to use MDBs for this purpose?
I was also thinking to send emails in a seperate thread from SessionBean, (Although starting new threads are not recommended according to Suns specs) but since my Session Bean is not part of any transaction i think using threads should not be a problem.
please advice

thanks
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would recommend going with your first idea: use MDBs. We do the same thing here to send emails to users when they change various parts of their accounts. It's not a good idea to create your own threads in a J2EE container not due to transactions but because the container manages them itself.

It's another case where you can do it, but you might be setting yourself up for disaster later. MDBs are so easy to use that it's not worth the risk in my view.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic