Is it a good idea to use a Session Bean to publish messages to a Topic? Assuming the Topic is in the same context...not a remote Topic...
The reason I am asking this question is...currently, I am using a SessionBean to publish messages to a Topic...but, in my SessionBean I have to lookup a ConnectionFactory, creating a connection, session etc., everytime....
Or is there a way to cache these objects and not look them up everytime....
Does anyone have any experience with this?
Use the connection factory java:/JmsXA
it provides pooling of java:/XAConnectionFactory
the in vm connection factory.
NOTE: It also enrolls the JMS XAResource in your
ejb transaction so the message is not sent
until the EJB transaction commits.