aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Use of MDBs for sending EMails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Use of MDBs for sending EMails" Watch "Use of MDBs for sending EMails" New topic
Author

Use of MDBs for sending EMails

Prakash Dwivedi
Ranch Hand

Joined: Sep 28, 2002
Posts: 452
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


Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of MDBs for sending EMails