commit | 860849e79e80e7fa8131e4871710783152247734 | [log] [tgz] |
---|---|---|
author | dongeforever <dongeforever@apache.org> | Thu Dec 06 15:35:57 2018 +0800 |
committer | dongeforever <dongeforever@apache.org> | Thu Dec 06 15:35:57 2018 +0800 |
tree | 3a778e75079e73787fa7c4d6e5dd24ec89d4129d | |
parent | 141c5bd632770cdad87728ce083f4aa9a36d4dbd [diff] |
Polish readme
RocketMQ-Client-CPP is the C/C++ client of Apache RocketMQ, a distributed messaging and streaming platform with low latency, high performance and reliability, trillion-level capacity and flexible scalability.
note: make sure the following compile tools or libraries have been installed before running the build script build.sh.
compile tools:
libraries:
The build.sh script will automatically download and build the dependency libraries including libevent, json and boost. It will save libraries under rocketmq-client-cpp folder, and then build both static and shared libraries for rocketmq-client. If the dependent libraries are built failed, you could try to build it manually with sources libevent 2.0.22, jsoncpp 0.10.6, boost 1.58.0
If your host is not available to internet to download the three library source files, you can copy the three library source files (release-2.0.22-stable.zip 0.10.6.zip and boost_1_58_0.tar.gz) to rocketmq-client-cpp root dir, then the build.sh will automatically use the three library source files to build rocketmq-client-cpp:
sh build.sh
Finally, both librocketmq.a and librocketmq.so are saved in rocketmq-client-cpp/bin. when using them to build application or library, besides rocketmq you should also link with following libraries -lpthread -lz -ldl -lrt. Here is an example:
g++ -o consumer_example consumer_example.cpp -lrocketmq -lpthread -lz -ldl -lrt
note: make sure the following compile tools or libraries have been installed before running the build script win32_build.bat:
The build script will automatically download dependent libraries including libevent json and boost to build shared library:
win32_build.bat
If your host is not available to internet to download the four library source files by build script, you can copy the four library source files
zlib-1.2.3-src Extract to $(rocketmq-client-cpp root dir)/thirdparty/zlib-1.2.3-src
libevent-release-2.0.22 Extract to $(rocketmq-client-cpp root dir)/thirdparty/libevent-release-2.0.22
boost_1_58_0 Extract to $(rocketmq-client-cpp root dir)/thirdparty/boost_1_58_0
jsoncpp-0.10.6 Extract to $(rocketmq-client-cpp root dir)/thirdparty/jsoncpp-0.10.6
And then run following command to build rocketmq-client:
win32_build.bat build
./SyncProducer -g group1 -t topic1 -c test message -n 172.168.1.1:9876
./AsyncProducer -g group1 -t topic -c test message -n 172.168.1.1:9876
./SendDelayMsg -g group1 -t topic -c test message -n 172.168.1.1:9876
./PushConsumer -g group1 -t topic -c test message -s sync -n 172.168.1.1:9876
./AsyncPushConsumer -g group1 -t topic -c test message -n 172.168.1.1:9876
./OrderlyPushConsumer -g group1 -t topic -c test message -s sync -n 172.168.1.1:9876
./OrderlyPushConsumer -g group1 -t topic -c test message -n 172.168.1.1:9876
./PullConsumer -g group1 -t topic -c test message -n 172.168.1.1:9876
-n : nameserver addr, format is ip1:port;ip2:port -i : nameserver domain name, parameter -n and -i must have one. -g : groupName, contains producer groupName and consumer groupName -t : message topic -m : message count(default value:1) -c : message content(default value: only test) -b : consume model(default value: CLUSTER) -a : set sync push(default value: async) -r : set retry times(default value:5 times) -u : select active broker to send message(default value: false) -d : use AutoDeleteSendcallback by cpp client(defalut value: false) -T : thread count of send msg or consume message(defalut value: system cpu core number) -v : print more details information