安装activeMq
jdk安装:https://www.linuxidc.com/Linux/2017-07/145563.htm
下载地址:http://activemq.apache.org/activemq-5155-release.html
wget http://mirrors.shu.edu.cn/apache//activemq/5.15.5/apache-activemq-5.15.5-bin.tar.gz
解压后不用安装直接启动:./bin/activemq start
在浏览器输入地址:localhost:8161/admin,默认帐号 admin admin

activeMq修改端口 /activemq/conf/activemq.xml

php 通过stomp协议连接ActiveMQ
一、安装php的stomp扩展
下载地址 http://pecl.php.net/package/stomp
解压后进入目录
/opt/php/bin/phpize
./configure--with-php-config=/opt/php/bin/php-config
make && make install
vim /opt/php/etc/php.ini 加入extension=stomp.so
二、使用composer安装stomp类库
composer require fusesource/stomp-php:2.0.*
demo代码及运行结果

在管理后台的队列中可以看到对应的数据

网友评论