I've activated prioritizedMessages in the activemq configuration, and priorities work fine, i.e. when I'm sending X messages, half of them with priority 0 and half of them with priority 9, the consumer receives the messages in the correct order.
However, when I'm calling the createConsumer() method with selectors such as CMSPriority > 0
or CMSPriority < 4
, no message is received.
Here's the relevant consumer code:
mSession = mConnection->createSession(Session::INDIVIDUAL_ACKNOWLEDGE);
mDestination = mSession->createQueue( mDestURI );
mConsumer = mSession->createConsumer(mDestination, "CMSPriority < 4");
When I change the last line to mConsumer = mSession->createConsumer(mDestination);
, all the messages are received, with correct priority.
Can anyone explain this behavior?