My program is using Java 8 (Oracle JDK) and the activemq-all 5.11.1 jar. I have a persistent queue of Job objects, and I'm trying to cherrypick cancelled Job objects from the queue using a message selector. However, the cherrypick is failing:
javax.jms.Session session; // no transactions, auto-ack javax.jms.Queue queue; // created from session javax.jms.MessageProducer producer; // created from queue javax.jms.MessageConsumer consumer; // created from queue // *** Message message = session.createObjectMessage(job); producer.send(message); String id = message.getJMSMessageID(); String selector = String.format("JMSMessageID = '%s'", id); MessageConsumer cherrypick = session.createConsumer(jobQueue, selector); Message test = cherrypick.receiveNoWait(); The cherrypick.receiveNoWait() call is returning null; I've flushed the queue with a consumer that doesn't have a message selector and confirmed that the message was in the queue. The JMS and selector strings look like: id ID:ZimZam-MacBook-Pro.local-59128-1437504907449-3:1:1:1:1 selector JMSMessageID = 'ID:Kevins-MacBook-Pro.local-59128-1437504907449-3:1:1:1:1' I'm not getting any errors about having a malformed selector. I've tried using a different session (with and without transactions) for the cherrypick consumer, but am still getting a null result from receiveNoWait. I have also tried setting and selecting on a JMSCorrelationID (a UUID with the dashes stripped from the string), and again no luck. My assumption is that the queue's contents are being buffered by the primary MessageConsumer ("consumer") making the messages unavailable for the cherrypick consumer, but haven't been able to find anything to confirm this and haven't found any configuration options to limit/disable buffering. I'm using Kaha as the persistence library, ActiveMQConnectionFactory as the connection factory, and vm://localhost:61616 as the broker URI. At present the broker is deleting all old messages on startup. -- View this message in context: http://activemq.2283324.n4.nabble.com/Message-selector-failing-in-ActiveMQ-queue-tp4699643.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.