Linux下activeMQ与c++客户端的部署与应用

activeMQ作为一个消息中间件,用于p2p或pub/sub模式的消息模型。此时业务上的客户端服务器都是客户端,而activeMQ作为服务器。
1. 怎么使用?
1. 以p2p模式为例,下载安装activeMQ,然后启动,然后运行。
2. 编写客户端1作为消息生产者,发送消息到activeMQ。
3. 编写客户端2作为消息消费者,从activeMQ接收消息。
2. 安装activeMQ
3. c++客户端开发环境搭建
cppunit
下载: https://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/
解压 然后
./configure –prefix=/usr/local/cppunit/
make
若make时出错:../../src/cppunit/.libs/libcppunit.so: undefined reference to `dlsym’

./configure –prefix=/usr/local/cppunit/ LDFLAGS=’-ldl’
make
make install (需要root权限执行)

apr
下载: http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz
./configure –prefix=/usr/local/apr/
make
make install

apr-util
下载: http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
解压后:
./configure –prefix=/usr/local/aprutil –with-apr=/usr/local/apr/
make
make install

(4)apr-iconv

这里选择最新的APR iconv 1.2.1版本,地址为:
http://mirrors.hust.edu.cn/apache//apr/apr-iconv-1.2.1.tar.gz

解压编译:
./configure –prefix=/usr/local/apr-iconv/ –with-apr=/usr/local/apr/
make
make install

(5)openssl

这里选择openssl 1.0.0a版本,下载地址为:
http://www.openssl.org/source/openssl-1.0.0a.tar.gz

解压编译:
./config –prefix=/usr/local/openssl/
make
make install

(6)ActiveMQ-CPP

这里选择最新的ActiveMQ-CPP 3.9.3版本,下载页面为:
http://activemq.apache.org/cms/activemq-cpp-393-release.html

解压编译:
./configure –prefix=/usr/local/ActiveMQ-CPP –with-apr=/usr/local/apr/ –with-cppunit=/usr/local/cppunit –with-openssl=/usr/local/openssl
make
make install

g++ test.cpp -I/usr/local/ActiveMQ-CPP/include/activemq-cpp-3.9.3 -I/usr/local/apr/include/apr-1 -L/usr/local/ActiveMQ-CPP/lib -lactivemq-cpp

其中-I指定了两个include目录,-L指定了一个库目录,-l指定了一个链接库。
编译通过,运行出错。未完待续

参考:
http://blog.csdn.net/lgh1700/article/details/51055784
http://blog.csdn.net/johnnywww/article/details/7689324

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值