Context jndiContext = getInitialContext();
TopicConnectionFactory factory = (TopicConnectionFactory)
jndiContext.lookup("ConnectionFactory");
Topic topic = (Topic) jndiContext.lookup("topic/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 topic/titan-TicketTopic...");
connect.start();