We are currently developing an application using JMS and activemq (5.5.1). We would like to determine a higher priority for some messages that would make them consume first. After installing the producer and consumer (through spring (3.1) JMSTemplate), priority will not fully work. Indeed, when we “turn off” the consumer and send some messages, priority is respected, but when we add messages while the consumer is on, messages are received in the same order in which they were sent.
The configuration is pretty simple:
Priority has been activated in the activemq configuration file:
<policyEntries> <policyEntry queue=">" prioritizedMessages="true"/> ... </policyEntries>
And the QoS setting was included in the manufacturer’s template configuration:
<bean id="jmsOCRTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="connectionFactory" /> <property name="defaultDestination" ref="destination_ocr" /> <property name="explicitQosEnabled" value="true" /> </bean>
To send a message with a high priority, we simply change the priority property of the template on the manufacturer's side:
template.setPriority(9);
Any idea? Is this normal behavior, or is there some kind of configuration that we would forget?
source share