繁体   English   中英

使用ProducerTemplate设置activemq优先级

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM