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
Prakash Dwivedi (SCJP2, SCWCD, SCBCD)
"Failure is not when you fall down, Its only when you don't get up again"
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.