Spring+ActiveMQ配置
一、Broker配置
1、broker.properties文件内容:
broker.tcp.local.name=localTcpBroker
broker.tcp.local.url=tcp\://localhost\:61616?trace\=true&keepAlive\=true
broker.tcp.local.queue=Q.TCP.LOCAL
2、beans-tcp-broker.xml文件内容:
<?xml version="1.0" encoding="UTF-8"?> <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.5.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:com/demo/broker.properties</value> </list> </property> </bean> <bean id="tcpConnector" class="org.apache.activemq.broker.TransportConnector"> <property name="uri" value="${broker.tcp.local.url}"></property> </bean> <bean id="tcpQueue" class="org.apache.activemq.command.ActiveMQQueue"> <property name="physicalName" value="${broker.tcp.local.queue}"></property> </bean> <bean id="kahaPersistenceAdapter" class="org.apache.activemq.store.kahadaptor.KahaPersistenceAdapter"> <property name="persistentIndex" value="true"></property> <property name="maxDataFileLength" value="1048576"></property> </bean> <bean id="kahaDBPersistenceAdapter" class="org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter"> <property name="checkForCorruptJournalFiles" value="true"></property> <property name="checkpointInterval" value="5000"></property> <property name="checksumJournalFile