[英]Set activemq priority using ProducerTemplate
是否有可能做到这一点?
我正在尝试使用以下命令发送到队列:
producerTemplate.sendBodyAndProperty("activemq:queue.queue", message, "JMSPriority", priority);
我已经设置了JMSConfiguration:
JmsConfiguration jmsConfiguration = new JmsConfiguration(pooledConnectionFactory);
jmsConfiguration.setDeliveryPersistent(false); // do not store a copy of the messages on the queue
jmsConfiguration.setPreserveMessageQos(true);
jmsConfiguration.setExplicitQosEnabled(true);
并且我还启用了activemq.xml
排队:
<policyEntry queue=">" prioritizedMessages="true" useCache="false" expireMessagesPeriod="0" queuePrefetch="1" >
</policyEntry>
但是,当我使用生产者模板发送消息时,activemq中显示的优先级为0:
即使当我正常发送消息时( producerTemplate.sendBodyAndProperty("activemq:queue.queue", message)
),优先级仍显示为4。
JMSPriority
应该是标头而不是属性。
producerTemplate.sendBodyAndHeader("activemq:queue.queue", message, "JMSPriority", priority);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.