It is just a suggestion, but how about use a MessageDriven bean to send emails? It is not necessary to send emails synchronously, so, why waste resources waiting for the email server to process your request?
You post a message to a queue and then the MDB can get it and send an email message using javamail.
Well, i could use MDB to send an email message but what if the message sent is a part of biggertransition?
In other word i should send the email during a transition and if the message sending fails the transition should fail too. Of course when i say fail i mean that the bean can't contact the mail server for example. Thanks
Joined: Nov 11, 2005
If the message sending fails, you could not confirm the message aknowledgement and it will be queued again. Later on you can try to send it again.
Using http connecttions in SLSB is a very valid scenario. Thats what the soap calls to webservices to under the wire.. Sending emails synchronously requires high resource availability, as the ejb container sometimes might timeout if the smtp server is busy. Adjusting the timeout is also not advisable. MDB could be a better solution. The SLSB client can poll (or PULL) the SLSB which can use JMS API to check the failure messages in the same queue.