commit | 729963a5669e5c16a24ccc16482b381feb2afc65 | [log] [tgz] |
---|---|---|
author | Jonnxu <jonnxu@163.com> | Fri Nov 16 02:13:29 2018 +0800 |
committer | GitHub <noreply@github.com> | Fri Nov 16 02:13:29 2018 +0800 |
tree | c8cd0db7f0f9bbee807f4710629c6851e071d5e4 | |
parent | 61a885871f046da53fd00bedd112744fda01cfdf [diff] |
udpate readme with newest format and content udpate readme with newest format and content
RocketMQ-Client-CPP is the C/C++ client of Apache RocketMQ which is a distributed messaging and streaming platform with low latency, high performance and reliability, trillion-level capacity and flexible scalability.
produce message, include sync and asynce produce message, timed and delay message.
consume message, include concurrency and orderly consume message, broadcast and cluster consume model.
rebalance, include both produce message and consume message with rebalance.
C and C++ API, include both C style and C++ style apis.
across platform, all features are supported on both windows and linux system.
libevent 2.0.22
jsoncpp 0.10.6
boost 1.56.0
doc/rocketmq-cpp_manaual_zh.docx
note: make sure the following compile tools or libraries with the indicated minimum version number have been installed before install dependency libraries
compile tools:
library:
./autogen.sh ./configure CFLAGS=-fPIC CPPFLAGS=-fPIC --disable-openssl --enable-static=yes --enable-shared=no make sudo make install
mkdir build; cd build cmake .. -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF make sudo make install
./bootstrap.sh sudo ./b2 cflags=-fPIC cxxflags=-fPIC --with-atomic --with-thread --with-system --with-chrono --with-date_time --with-log --with-regex --with-serialization --with-filesystem --with-locale --with-iostreams threading=multi link=static runtime-link=static release install
mkdir build; cd build cmake .. -DBUILD_ROCKETMQ_STATIC=ON -DBUILD_ROCKETMQ_SHARED=ON -DBoost_USE_STATIC_LIBS=ON - DBoost_USE_MULTITHREADED=ON -DBoost_USE_STATIC_RUNTIME=ON -DLibevent_USE_STATIC_LIBS=ON -DJSONCPP_USE_STATIC_LIBS=ON make sudo make install
when user need static library, we can package all the static library of libevent jsoncpp boost rocketmq and signature to one static library, so user can only link to librocketmq.a, no need to link libevent jsoncpp and boost again. create a file named packet_rocketmq.mri with the content as follows:
create librocketmq.a addlib /usr/local/lib/libboost_chrono.a addlib /usr/local/lib/libboost_date_time.a addlib /usr/local/lib/libboost_filesystem.a addlib /usr/local/lib/libboost_iostreams.a addlib /usr/local/lib/libboost_locale.a addlib /usr/local/lib/libboost_log.a addlib /usr/local/lib/libboost_log_setup.a addlib /usr/local/lib/libboost_regex.a addlib /usr/local/lib/libboost_serialization.a addlib /usr/local/lib/libboost_system.a addlib /usr/local/lib/libboost_thread.a addlib /usr/local/lib/libboost_wserialization.a addlib /usr/local/lib/libevent.a addlib /usr/local/lib/libevent_core.a addlib /usr/local/lib/libevent_extra.a addlib /usr/local/lib/libevent_pthreads.a addlib /usr/local/lib/libjsoncpp.a addlib /usr/local/lib/librocketmq.a addlib /usr/local/lib/libSignature.a save end
then execute the flowing command:
ar -M < package_rocketmq.mri sudo rm -rf /usr/local/lib/librocketmq.a sudo rm -rf /usr/local/lib/libSignature.a cp -f librocketmq.a ./bin sudo cp -f librocketmq.a /usr/local/lib
librocketmq.a and librocketmq.so will be exist in local folder bin and system folder /usr/local/lib
install libevent 2.0.22 extract libevent to C:/libevent open Virtual Studio command line tools, go to dir: C:/libevent execute cmd: nmake /f Makefile.nmake cp libevent.lib, libevent_extras.lib and libevent_core.lib to C:/libevent/lib
install jsoncpp 0.10.6 extract jsoncpp to C:/jsoncpp download cmake windows tool and extract run cmake-gui.exe, choose your source code dir and build dir, then click generate which will let you choose Virtual Studio version open project by VirtualStudio, and build jsoncpp, and jsoncpp.lib will be got
install boost 1.56.0 according to following discription: http://www.boost.org/doc/libs/1_56_0/more/getting_started/windows.html following build options are needed to be set when run bjam.exe: msvc architecture=x86 address-model=64 link=static runtime-link=static stage all lib will be generated except boost_zlib: download zlib source and extract to directory C:/zlib run cmd:bjam.exe msvc architecture=x86 address-model=64 link=static runtime-link=static --with-iostreams -s ZLIB_SOURCE=C:\zlib\src\zlib\1.2.3\zlib-1.2.3 stage
run cmake-gui.exe, choose your source code dir and build dir, then click generate which will let you choose VirtualStudio version if generate project solution fails, change BOOST_INCLUDEDIR/LIBEVENT_INCLUDE_DIR/JSONCPP_INCLUDE_DIR in CMakeList.txt, according to its real install path open&build&run project by VirtualStudio
./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 : setup 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