一、应用需求
在Tomcat本身没有提供J2EE的JMS服务,可以借助ActiveMQ来实现。
二、关于ActiveMQ
activeMQ是J2EE规范的jms实现,它是一个消息服务器,提供queue、topic(发布订阅)等方式的消息模式。做为一个服务器端,可以配置集成在Tomcat等一起,启动Tomcat即可使用消息服务。亦可独立使用,作为一个独立服务器。activeMQ(5.3.0版本)提供了服务器管理页面,运行在自带的jetty服务器。
1. 独立使用
activeMQ是Apache的一个开源项目,从Apache官方网站可以下载最新版。
解包后,到bin目录下可以运行启动脚本(win) activemq.bat,启动后即可使用消息服务器。
默认监听端口:tcp://ip(localhost):61616
管理页面:http://ip(localhost):8161/admin
2.集成tomcat
web.xml 配置:
brokerURI
/WEB-INF/activemq.xml
org.apache.activemq.web.SpringBrokerContextListener
activemq.xml配置(oracle):
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-5.2.0.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
http://activemq.apache.org/schema/core" brokerName="localhost">
三、实用体会
四、商用前景
1. 稳定性
2.效率
3.开源组织背景
五、总结