作者:鸟鸟212 | 来源:互联网 | 2023-08-16 15:45
1 安装openssl依赖。apt-getinstalllibssl-dev2安装rabbitmq-c和gitclonehttps:github.comalanxzrabbitm
1 安装openssl依赖。
apt-get install libssl-dev
2 安装 rabbitmq-c和
git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c
git clone https://github.com/rabbitmq/rabbitmq-codegen.git
mv rabbitmq-codegen codegen //重命名codegen
mkdir build
cd build
cmake ..
cmake --build .
make
sudo make install
3 安装rabbitmq-server
sudo apt-get install rabbitmq-server
4 启动web监控:
sudo rabbitmq-server
5 启用web监控
sudo rabbitmq-plugins enable rabbitmq_management
6 查看服务
sudo rabbitmq-plugins list
7 启动服务:
sudo service rabbitmq-server start
8 将服务加入到开机自启动服务中:
sudo chkconfig rabbitmq-server on
9 测试
运行example,编译后example的可执行文件,位于rabbitmq-c/build/examples/ 中,打开一个终端:
./examples/amqp_listen localhost 5672 amq.direct test
再打开一个终端:
./examples/amqp_sendstring localhost 5672 amq.direct test "hello, rabbitmq"
测试OK