通过JMS插件在Grails中使用ActiveMQ我无法想象如何设置KahaDb持久性属性。
尝试过类似的事情:
amq.broker(useJmx: true, persistent: true) {
amq.transportConnectors() {
amq.transportConnector(uri: "tcp://0.0.0.0:61616")
}
amq.persistenceAdapter() {
amq.kahaDB(directory:${application.config.grails.moviesxd.activemq.kahadb},
checksumJournalFiles:true,
checkForCorruptJournalFiles:true,
ignoreMissingJournalfiles:true)
}
}
但是我得到了
groovy.lang.GroovyRuntimeException: Namespace prefix: kahadb is not bound to a URI
似乎kahadb前缀似乎无法识别但我无法在任何地方找到有关如何执行此操作的文档。
答案 0 :(得分:0)
作为一种解决方法,我所做的就是包含一个额外的resources.xml,并使用标准且记录良好的XML属性:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<amq:broker useJmx="true" persistent="true">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://0.0.0.0:61616" />
</amq:transportConnectors>
<amq:persistenceAdapter>
<amq:kahaDB directory="${grails.moviesxd.activemq.kahadb.path}" />
</amq:persistenceAdapter>
</amq:broker>
<amq:connectionFactory id="amqConnectionFactory"
brokerURL="vm://localhost" />
<bean id="jmsConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
<constructor-arg ref="amqConnectionFactory" />
</bean>
</beans>
......但是我必须做到这一点......如果我得到答案,仍然会很棒。
答案 1 :(得分:0)
你只是缺少相应的
xmlns:amq='http://activemq.apache.org/schema/core'
将是
xmlns amq:'http://activemq.apache.org/schema/core'
(有关详细信息,请参阅reference docs - 搜索&#34;使用Spring命名空间&#34;)
因此整个转换将是
import org.springframework.jms.connection.SingleConnectionFactory
xmlns amq:'http://activemq.apache.org/schema/core'
amq.broker(useJmx: true, persistent: true) {
amq.transportConnectors {
amq.transportConnector(uri: 'tcp://0.0.0.0:61616')
}
amq.persistenceAdapter {
amq.kahaDB(directory: application.config.grails.moviesxd.activemq.kahadb,
checksumJournalFiles: true,
checkForCorruptJournalFiles: true,
ignoreMissingJournalfiles: true)
}
}
amq.connectionFactory(id: 'amqConnectionFactory', brokerURL: 'vm://localhost')
jmsConnectionFactory(SingleConnectionFactory, ref('amqConnectionFactory'))