It is often said here (for good reason) that creating a JMS connection per 
request is an anti-pattern, but there is something i'm not quite clear about.
Should i maintain in my EJBs a reference to a session, a message producer, 
something else?

With a persistence unit in a Stateless, the transaction is per request and the 
persistence context is per request too (after that the entities are detached 
from the session).

So if i translate this from JPA to JMS and JBM, shouldn't the session be in the 
same scope as the transaction?
But if in a Stateless i hold a reference to a JMS session, for instance created 
from the ConnectionFactory in a PostConstruct method, that session will last 
longer than the request because the EJB is pooled (and if wasn't there would be 
no point in holding the Session rather than the SessionFactory)

But then the JMS interfaces are ConnectionFactory not SessionFactory so maybe 
they are more like JDBC connections and if so how?

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

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238581
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to