I am submitting large models for solving to a MQ. Sometimes the engineer pushes the wrong button I need to remove those message before they take CPU time. All the messages have a set of message properties that allow for easy selection by a message selector. I have a business method implemented in a stateless session bean that removes messages from the queue by creating a queueReceiver with a unique message selector. The method works fine on the initial call, but subsequent calls yield nothing. No exceptions or messages, yet the message is their and should have been consumed. I am using JBoss 3.0.0 with the following excerpt of code. Any ideas why this fails?
QueueSession queueSession =
connect.createSession(false, Session.AUTO_ACKNOWLEDGE);
QueueReceiver queueReceiver = queueSession.createReceiver(queue, "A = 'a' AND B = 'b'");
queueConnection.start();
Message message = queueReceiver.receiveNoWait();
queueConnection.stop();
if (message == null) {
return false;
} else {
return true;
}