// in that case, a boolean which is true if the message was removed, false else
boolean messageRemoved = (Boolean)JMSManagementHelper.getResult(reply);
System.out.println("message has been removed: " + messageRemoved);
// Step 21. Create a JMS Message Consumer on the queue
MessageConsumer messageConsumer = session.createConsumer(queue);
// Step 22. Trying to receive a message. Since the only message in the queue was removed by a management
// operation,
// there is none to consume. The call will timeout after 5000ms and messageReceived will be null
TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);