Win a copy of Fixing your Scrum this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Message Driven Beans

 
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given that bean implementation must be single threaded can JavaMail be used from a Message Driven Bean?

Thanks,
Vasu
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course The requirement that enterprise beans be single threaded means that you are not allowed to create and manage custom threads within the bean class.
Usually, when you want to use the JavaMail API, you do that through what we call a resource manager connection factory reference. In clear, in the onMessage() method you can retrieve a JavaMail connection factory from the recommended JNDI subcontext called java:comp/env/mail (see section 20.4.1.1 of the EJB 2.0 spec). Sample code is given below:

You also have to create the mail session in your server console and give it the JNDI name "mail/MySession".
Hope this helps...
[ April 07, 2004: Message edited by: Valentin Crettaz ]
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic