<bean id="myTopic" class="org.apache.activemq.command.ActiveMQTopic">
<property name="physicalName" value="feed.topic" />
</bean>
<bean id="myConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="failover:tcp://localhost:61616" />
</bean>
<bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="myConnectionFactory" />
<property name="defaultDestination" ref="myTopic" />
</bean>
<bean id="sender" class="com.feed.publish.PublishMessages">
<property name="jmsTemplate" ref="myJmsTemplate" />
</bean>
我使用 spring 框架进行了上述设置,该框架允许我将消息发布到队列。但是,如果 activemq 实例在进程中终止,我希望它将消息写入磁盘/文件,直到可以重新建立连接。我在 activemq 的网站上找到了示例代码,但是我不确定如何将它集成到我当前的设置中
<amq:broker useJmx="true" persistent="true" brokerName="localhost">
<amq:persistenceAdapter>
<amq:kahaPersistenceAdapter directory="activemq-data"
maxDataFileLength="33554432" />
</amq:persistenceAdapter>
<amq:transportConnectors>
<amq:transportConnector name="vm" uri="vm://localhost" />
</amq:transportConnectors>
</amq:broker>
有人可以告诉我如何合并这两种风格吗?谢谢