I'm trying to create a servlet which enables it's users to delete messages from a queue.
My code is working when I run it as standalone but it is not working when I execute it as a servlet. (Although I do get a positive reply from my request the messages are not actually removed from the queue)
I guess there is something I should do different since it's a servlet but I'm not sure what it is.
InitialContext context = getContext(); // Same context used to send a message using a servlet - which works QueueConnectionFactory cf = (QueueConnectionFactory)context.lookup("/ConnectionFactory"); QueueConnection connection = cf.createQueueConnection("user", "password"); connection.start(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue managementQueue = HornetQJMSClient.createQueue("hornetq.management"); QueueRequestor requestor = new QueueRequestor(session, managementQueue);