Spring ActiveMQ

本文详细介绍了如何在Spring框架中配置和使用ActiveMQ,包括Broker的配置,如broker.properties和beans-tcp-broker.xml文件内容,以及消息生产者和消费者的配置,包括相应XML文件、消息转换类和消费者类的实现。
摘要由CSDN通过智能技术生成

Spring+ActiveMQ配置

8人收藏此文章,我要收藏 发表于2年前(2010-12-09 16:35) , 已有 1988次阅读 ,共 3个评论

一、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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值