ConnectionFactory cf = (ConnectionFactory) context.lookup("cf");
javax.jms.Queue queue =(Queue)context.lookup("queue");
context.close();
Connection cnx = cf.createConnection();
Session session = (Session) cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
// session.setImplicitAck(true);
session.setQueueMessageReadMax(100);
MessageConsumer consumer = (MessageConsumer) session.createConsumer(queue);
consumer.setMessageListener(new MyListener());
cnx.start();
System.in.read();
session.close();
cnx.close();
System.exit(0);
}