先来温顾一下ActiveMQ5.0提供的主要功能:
1.ActiveMQ5.0消息中间件实现了JMS1.1规范
2.支持点对点、发布/订阅式消息;
3.支持持久消息;
开始tomcat5.5 + sprng2.0 + ActiveMQ的配置
目标:
1.tomcat启动时,也同时启时ActiveMQ服务
2.配置发送、接收消息的模板,使代码编写不必再配置发送、接收过程,而可以直接对消息做处理
参考文档:
一.准备工作:
所需jar
activeMQ
SPRING
XBEAN
jakarta-commons
...
二.Tomcat中启动ActiverMQ的配置(Spring整合)
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:incx/activemq/conf/spring-activeMQ-service.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
------------------------------------------------------------------------------------------------
--------------------------- spring-activeMQ-service.xml ----------------------------
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
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.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd">
<!-- Server configure -->
<!-- create an embedded ActiveMQ Broker -->
<amq:broker useJmx="false" persistent="false">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61616"/>
</amq:transportConnectors>
</amq:broker>
</beans>
-------------------------------------------------------------------------------------------------

