Context jndiContext = getInitialContext();
QueueConnectionFactory factory = (QueueConnectionFactory)
jndiContext.lookup("java:comp/env/jms/QueueFactory");
Queue ticketQueue = (Queue)
jndiContext.lookup("titan-TicketQueue");
QueueConnection connect = factory.createQueueConnection();
QueueSession session =
connect.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
QueueReceiver receiver = session.createReceiver(ticketQueue);
receiver.setMessageListener(this);
System.out.println("Listening for messages on titan-TicketQueue...");
connect.start();