I have a EJB method. This transaction is managed by the container. This method calls a database and invokes the JMS. Inside the method, I obtained the TopicSession and published message to the session. Since I do not have control on the transaction, when should I call the TopicSession.close() to properly release the obtained session. Or should I depends on server GC to dispose the TopicSession?
You must close it when you have finished with it.
The transaction commit will send the message.