我们在 ActiveMQ 中有一个问题,我们有大量的消息没有丢弃主题。主题设置为非持久性、非持久性。我们的 Activemq.xml 文件是
<beans>
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="false" persistent="false">
<!--
<persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
</persistenceAdapter>
-->
<transportConnectors>
<transportConnector uri="vm://localhost"/>
</transportConnectors>
</broker>
</beans>
我们在messaging-config.xml 中的主题定义是
<destination id="traceChannel">
<properties>
<network>
<session-timeout>10</session-timeout>
</network>
<server>
<message-time-to-live>10000</message-time-to-live>
<durable>false</durable>
<durable-store-manager>flex.messaging.durability.FileStoreManager</durable-store-manager>
</server>
<jms>
<destination-type>Topic</destination-type>
<message-type>javax.jms.ObjectMessage</message-type>
<connection-factory>ConnectionFactory</connection-factory>
<destination-jndi-name>dynamicTopics/traceTopic</destination-jndi-name>
<delivery-mode>NON_PERSISTENT</delivery-mode>
<message-priority>DEFAULT_PRIORITY</message-priority>
<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
<transacted-sessions>false</transacted-sessions>
<initial-context-environment>
<property>
<name>Context.INITIAL_CONTEXT_FACTORY</name>
<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
</property>
<property>
<name>Context.PROVIDER_URL</name>
<value>tcp://localhost:61616</value>
</property>
</initial-context-environment>
</jms>
</properties>
<channels>
<channel ref="rtmps" />
</channels>
<adapter ref="trace" />
</destination>
我想要实现的是,任何时候只有最后 10 条消息是关于主题的,因为让它在一夜之间运行会导致超过 150K 条关于该主题的消息,即使它应该只包含非常小的数量。