我的IT基础架构需要基于SQL Server 2008 R2数据库的持久性。
我正在尝试在Windows上为ActiveMQ 5.9配置SQL Server持久性,但无论是否使用日记功能都无法找到正确的配置架构。
默认配置使用kahadb,它可以工作:
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb" />
</persistenceAdapter>
我正在使用此文档作为配置SQL Server持久性的参考: http://activemq.apache.org/sqlserver.html
<persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data" dataSource="#mssql-ds">
<adapter><imageBasedJDBCAdaptor/></adapter>
</journaledJDBC>
</persistenceAdapter>
<bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="url" value="jdbc:sqlserver://HOST:PORT;databaseName=DBNAME;user=USER;password=PASSWORD"/>
<property name="username" value="USER"/>
<property name="password" value="PASSWORD"/>
</bean>
这是我得到的xml解析器中的错误:
错误|无法加载:类路径资源[activemq.xml],原因:来自类路径资源[activemq.xml]的XML文档中的第88行无效;嵌套异常是org.xml.sax.SAXParseException; lineNumber:88; columnNumber:95; cvc-complex-type.2.4.a:从元素'journaledJDBC'开始发现无效内容。其中一个'{“http://activemq.apache.org/schema/core”:jdbcPersistenceAdapter,“http://activemq.apache.org/schema/core”:journalPersistenceAdapter,“http://activemq.apache.org/schema/core”:kahaDB,“http://activemq.apache.org/schema/core”:levelDB,“http://activemq.apache.org/schema/core “:mKahaDB,”http://activemq.apache.org/schema/core“:memoryPersistenceAdapter,”http://activemq.apache.org/schema/core“:replicatedLevelDB,WC [## other:”http://activemq.apache.org/schema/core“]}'是预期的。
请帮我弄清楚SQL Server持久性的配置架构,或提供特定于版本ActiveMQ 5.9的文档链接
答案 0 :(得分:3)
这是我用于oracle的东西。也许这只是从数据源更改jdbc信息(与任何其他数据源一样)
(抱歉,这里没有SQL Server可供测试)
<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.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" producerFlowControl="true">
<pendingMessageLimitStrategy>
<constantPendingMessageLimitStrategy limit="1000" />
</pendingMessageLimitStrategy>
</policyEntry>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<persistenceAdapter>
<jdbcPersistenceAdapter dataSource="#oracle-ds" />
</persistenceAdapter>
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage limit="128 mb" />
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb" />
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb" />
</tempUsage>
</systemUsage>
</systemUsage>
<transportConnectors>
<transportConnector name="tcp" uri="tcp://0.0.0.0:61616" />
</transportConnectors>
</broker>
<bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" />
<property name="username" value="xxx" />
<property name="password" value="xxx" />
<property name="poolPreparedStatements" value="true" />
<property name="maxActive " value="30" />
</bean>
</beans>