I am just starting to gain knowledge and use JMS(activemq). The pseudo code looks like below
// 1. TopicConnectionFactory tcf = (TopicConnectionFactory) ctx.lookup("XXConnFactory");
// 2. TopicConnection connection = tcf.createTopicConnection();
// 3. TopicSession topicSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
then using the topicSession i create publisher and call publish() method.
Question is, when do I initialize TopicConnection/TopicSession. Is it like I can have TopicConnection initialized once and use the same connection to get a session for each calls?
Basically I want to know which can be instantiated once and which should be instantiated for every call.