[jboss-user] [JBoss Messaging Users] - Stateless Session Bean and JMS best practice

ab2003 do-not-reply at jboss.com
Fri Sep 25 16:23:37 EDT 2009


Based on this forum post 
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=127090

the create/close a connection and session per JMS message is considered an anti-pattern.

For reference, we are using JBoss EAP 4.3.0 and JBoss Messaging 1.4.0.SP3

What is the best practice for a Stateless Session Bean that sends JMS messages in response to some (high throughput) external stimulus?

Should there be one Session and Connection per Bean instance, potentially creating hundreds of these references depending on the size of the EJB pool?  

Or are the Session and Connection objects thread-safe, and assuming that the application is not calling close() on them, can one Session/Connection per JMS destination be used safely?

We currently use the connection/session-per-bean-instance model, but are wondering if we are creating unnecessary overhead by doing so.  Profiling the heap shows thousands of JBossSession and JBossConnection objects because the EJB pools have expanded to handle heavy load.

Thanks for any pointers on best-practice.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257140#4257140

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257140



More information about the jboss-user mailing list