Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling JavaMail from EJB  RSS feed

 
Jim Baker
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Which way is better to call JavaMail from
a session EJB, directly call JavaMail API
from the EJB or let the EJB container
do the work?
JB
 
zingaroo
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what do mean when u say <<let the EJB container do the work?>>
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For sending emails, using an asynschronous approach would be the best option. Therefore, create a message-driven bean, and access the JavaMail API from you onMessage() method in your bean.
SAF
 
Jim Baker
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
zingaroo:
I heard that JavaMail is part of J2EE and
it can be configured in deployment descriptor.
So the container handles the JavaMail APIs.
I think I can also call JavaMail API
from EJB w/o going through container.
Correct me if I'm wrong.
JB
 
zingaroo
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think it has more to do with the vendor implementation and not the J2EE specifications as such.
Yes as suggested already an MDB is the best for asynchronous messaging.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!