Context jndiContext = getInitialContext();
TopicConnectionFactory factory = (TopicConnectionFactory)
// jndiContext.lookup("java:comp/env/jms/TopicFactory");
jndiContext.lookup("titan-TopicFactory");
// Topic topic = (Topic) jndiContext.lookup("java:comp/env/jms/TicketTopic");
Topic topic = (Topic) jndiContext.lookup("titan-TicketTopic");
TopicConnection connect = factory.createTopicConnection();
TopicSession session =
connect.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicSubscriber subscriber = session.createSubscriber(topic);
subscriber.setMessageListener(this);
System.out.println("Listening for messages on titan-TicketTopic...");
connect.start();