Context jndiContext = getInitialContext ();
QueueConnectionFactory factory = (QueueConnectionFactory)
jndiContext.lookup ("ConnectionFactory");
Queue ticketQueue = (Queue)
jndiContext.lookup ("queue/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 ();