一.安装ActiveMQ
首先去http://activemq.apache.org/download.html 下载最新版本4.1.0release (http://activemq.apache.org/activemq-410-release.html),
解压apache-activemq-4.1-incubator.zip(或者apache-activemq-4.1-incubator.tar.gz)目录如下:
+bin (windows下面的bat和unix/linux下面的sh)
+conf (activeMQ配置目录,包含最基本的activeMQ配置文件)
+data (默认是空的)
+docs (index,replease版本里面没有文档,-.-b不知道为啥不带)
+example (几个例子
+lib (activemMQ使用到的lib)
-apache-activemq-4.1-incubator.jar (ActiveMQ的binary)
-LICENSE.txt
-NOTICE.txt
-README.txt
-user-guide.html
你可以使用bin\activemq.bat(activemq) 启动,如果一切顺利,你就会看见类似下面的信息
(细节可能不一样,比如路径,或者jmx,jdbc信息)
ACTIVEMQ_HOME: D:\java\framework_and_lib\activemq\apache-activemq-4.1-incubator\
bin\..
Loading message broker from: xbean:activemq.xml
INFO BrokerService - ActiveMQ null JMS Message Broker (localho
st) is starting
INFO BrokerService - For help or more information please see:
http://incubator.apache.org/activemq/
INFO ManagementContext - JMX consoles can connect to service:jmx:r
mi:///jndi/rmi://localhost:1099/jmxrmi
INFO JDBCPersistenceAdapter - Database driver recognized: [apache_derby
_embedded_jdbc_driver]
INFO DefaultDatabaseLocker - Attempting to acquire the exclusive lock
to become the Master broker
INFO DefaultDatabaseLocker - Becoming the master on dataSource: org.ap
ache.derby.jdbc.EmbeddedDataSource@1d840cd
INFO JournalPersistenceAdapter - Journal Recovery Started from: Active Jou
rnal: using 5 x 20.0 Megs at: D:\java\framework_and_lib\activemq\apache-activemq
-4.1-incubator\activemq-data\journal
INFO JournalPersistenceAdapter - Journal Recovered: 0 message(s) in transa
ctions recovered.
INFO TransportServerThreadSupport - Listening for connections at: tcp://P-SUW
EI:61616
WARN MulticastDiscoveryAgent - brokerName not set
INFO TransportConnector - Connector default Started
INFO TransportServerThreadSupport - Listening for connections at: stomp://P-S
UWEI:61613
INFO TransportConnector - Connector stomp Started
INFO NetworkConnector - Network Connector default Started
INFO BrokerService - ActiveMQ JMS Message Broker (localhost, I
D:P-SUWEI-1207-1170916242296-1:0) started
*。几个小提示
1. 这个仅仅是最基础的ActiveMQ的配置,很多地方都没有配置因此不要直接使用这个配置用于生产系统
2. 有的时候由于端口被占用,导致ActiveMQ错误,ActiveMQ可能需要以下端口1099(JMX),61616(默认的TransportConnector)
3. 如果没有物理网卡,或者MS的LoopBackAdpater Multicast会报一个错误
二. 测试你的ActiveMQ
由于ActiveMQ是一个独立的jms provider,所以我们不需要其他任何第三方服务器就可以马上做我们的测试了.编译
example目录下面的程序
ProducerTool/ConsumerTool 是JMS参考里面提到的典型应用,Producer产生消息,Consumer消费消息
而且这个例子还可以加入参数帮助你测试刚才启动的本地ActiveMQ或者是远程的ActiveMQ
ProducerTool [url] broker的地址,默认的是tcp://localhost:61616
[true|flase] 是否使用topic,默认是false
[subject] subject的名字,默认是TOOL.DEFAULT
[durabl] 是否持久化消息,默认是false
[messagecount] 发送消息数量,默认是10
[messagesize] 消息长度,默认是255
[clientID] durable为true的时候,需要配置clientID
[timeToLive] 消息存活时间
[sleepTime] 发送消息中间的休眠时间
[transacte] 是否采用事务
ConsumerTool [url] broker的地址,默认的是tcp://localhost:61616
[true|flase] 是否使用topic,默认是false
[subject] subject的名字,默认是TOOL.DEFAULT
[durabl] 是否持久化消息,默认是false
[maxiumMessages] 接受最大消息数量,0表示不限制
[clientID] durable为true的时候,需要配置clientID
[transacte] 是否采用事务
[sleepTime] 接受消息中间的休眠时间,默认是0,onMeesage方法不休眠
[receiveTimeOut] 接受超时
在linux系统下打开中终端
1.输入 telnet 192.168.11.11 61613
#备注: 192.168.11.11是activemq的地址服务器 61613是默认端口
2.输入 CONNECT
#备注:连接作用(必须大写)
3.输入
SUBSCRIBE
destination:/topic/test
#备注:SUBSCRIBE订阅 destination:/topic/test 订阅的目标
4输入
SEND
destination:/topic/test
hello word
#备注:SEND发送 destination:/topic/test 发送 hello word 给此目标
最终效果如下
[root@localhost bin]# telnet 192.168.1.123 61613
Trying 192.168.1.123...
Connected to 192.168.1.123 (192.168.1.123).
Escape character is '^]'.
CONNECT
^@
CONNECTED
session:ID:localhost.localdomain-57402-1228792371856-4:3
SUBSCRIBE
destination: /topic/test
^@
SEND
destination:/topic/test
hello test
^@
MESSAGE
message-id:ID:localhost.localdomain-57402-1228792371856-4:3:-1:1:1
destination:/topic/test
timestamp:1228795847692
expires:0
priority:0
hello test
此方法可以除了检测ActiveMQ是否启动,更重要的是在做ActiveMQ开发时起到测试的作用
分享到:
相关推荐
ActiveMQ安装及配置文档介绍了ActiveMQ的安装过程和配置。让新手踏入JMS的门槛。
1、 ActiveMQ 安装1
3、 解压安装 $ tar -zxvf apache-activemq-5.11.1-bin.tar.gz $ mv apache-activemq-5.11.1 activemq-01 如果启动脚本activemq没有可执行权限,此时则需要授权(此步可选) $ cd /home/xiaoxg/activemq-01/bin/ $ ...
ActiveMQ 安装 手册 说明 ActiveMQ实战(linux):安装与运行 下载与安装 cp apache-activemq-5.3.0-bin.tar.gz /usr/local/ chmod -R 777 apache-activemq-5.3.0
activemq安装
JDK Tomcat ActiveMQ 安装环境配置详细说明
而且ActiveMQ虽然网络资源很多, 但是往往资料过于老旧,或者更多的集中于SpringBoot 和ActiveMQ的集成,对于如何把ActiveMQ安装和详细的端口配置,往往语焉不详, 对于Jetty Web管理端(admin)和具体的JMS 端口的...
整理完成的资料,详细介绍ActiveMq的安装和使用,方便大家下载
ActiveMQ安装文档, ActiveMQ安装文档, ActiveMQ安装文档
文档对activemq安装和使用描述的很详细,还有activemq集群部署写的也很详细,对着操作就能完成
1. 环境 • Win7 64 • JDK 1.8.0_65 • ActiveMq apache-activemq-5.13.3-bin.zip
activemq-5.16.3安装,linux环境。 内容:包括所需文件,安装文档
ActiveMQ 的安装与使用,ActiveMQ与spring整合,生产都、消费者、测试类等。
ActiveMQ5.13 安装与配置
ActiveMQ的安装与使用ActiveMQ的安装与使用ActiveMQ的安装与使用
ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现,尽管JMS规范出台已经是很久的事情了,...附件资料主要含:ActiveMQ包,安装配置文档,将服务端做成服务文档及与spring框架结合的导入即可运行实例!
linux系统ActiveMQ安装部署手册
luinx安装activeMQ含安装包,简单安装
linux下activemq安装包和配置文档
主要介绍了ActiveMQ安装及部署教程图解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下