Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

EJB Messaging, Part I: JMS and JavaMail-2 : Page 2


advertisement

EJBs and Resource Manager Connection Factories
An EJB's participation in a messaging exchange begins with the resource manager. A resource manager is a J2EE component that manages the life cycle of a resource type, from connection pooling to transaction support to network communication. Through JNDI, the resource manager obtains factory objects called resource manager connection factories, which the container manages and maintains. EJBs use these resource manager connection factories to access extra-container resources (standard enterprise components that are not a core part of a J2EE container). JMS sessions and JavaMail sessions are among the resources an EJB can access with resource manager connection factories.

The EJB API uses the factory design pattern to provide access to resource manager connection objects. The factory pattern uses one class object (the factory) that returns references to objects of another class. This way, the factory class encapsulates the management of the resource connection objects, allowing caching, object recycling, and other types of optimizations. Additionally, the factory pattern separates the container's implementation from the EJB code, allowing the maximum degree of extensibility and scalability.

The information corresponding to a resource manager connection factory is described in the bean's deployment descriptor:




<enterprise-beans>
   <session>
      
      <resource-ref>
         <description> This is a textual description of 
the resource.</description> <res-ref-name>jms/topicConnFactory</res-ref-name> <res-type>javax.jms.TopicConnectionFactory</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Sharable</res-sharing-scope> </resource-ref> </session> </enterprise-beans>

The <res-ref-name> element identifies the JNDI name to which the connection factory reference should be bound. It is this name that is used in the enterprise bean code to obtain a reference. The <res-type> element indicates the factory object type. The <res-auth> and <res-sharing-scope> elements declare how the factory will be managed.

Two of the elements, <description> and <res-sharing-scope>, are optional.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date