我正在尝试清除 activeMQ 中的非活动队列
<amq:broker persistent="true" useJmx="true" schedulePeriodForDestinationPurge="1000">
<amq:destinationPolicy>
<amq:policyMap>
<amq:policyEntries>
<amq:policyEntry queue="queue.>" gcInactiveDestinations="true" inactiveTimoutBeforeGC="5000" />
</amq:policyEntries>
</amq:policyMap>
</amq:destinationPolicy>
正如我所读到的,当有 0 条消息且没有新的生产者/消费者时,队列处于非活动状态。
我正在使用 jmsTemplate 发送这样的过程:
//Creates an org.springframework.jms.connection.CachingConnectionFactory
conn = jmsTemplate.getConnectionFactory().createConnection();
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
...
jmsTemplate.convertAndSend(destinationQueue, messageDTO);
....
session.close();
conn.close();
在调用 convertAndSend 方法的那一刻,创建了生产者和队列,但是当发送完成时,生产者仍然活着(jconsole 指示 producerCount=1),尽管我关闭了会话和连接,所以队列没有被清除。
为什么生产者没有被删除?会影响使用缓存连接工厂吗?
谢谢!