-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
146 changed files
with
37,598 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
*.os | ||
*.scons* | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
*.so.1 | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
# Dependency file | ||
*.d | ||
|
||
# Mac swap file | ||
*.DS_Store | ||
|
||
# Linux swap file | ||
*.swp | ||
|
||
# Exclude compiled executables | ||
/examples/SampleProducer | ||
/examples/SampleConsumer | ||
/examples/SampleAsyncProducer | ||
/examples/SampleConsumerListener | ||
/tests/main | ||
/perf/PerfProducer | ||
/perf/PerfConsumer | ||
/system-test/SystemTest | ||
|
||
# Eclipse generated files | ||
.cproject | ||
.project | ||
.settings/ | ||
.pydevproject | ||
|
||
# doxygen files | ||
apidocs/ | ||
|
||
# CMAKE | ||
Makefile | ||
cmake_install.cmake | ||
CMakeFiles | ||
CMakeCache.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# | ||
# Copyright 2016 Yahoo Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
cmake_minimum_required(VERSION 2.8) | ||
project (pulsar-cpp) | ||
|
||
set(Boost_NO_BOOST_CMAKE ON) | ||
|
||
set (CMAKE_CXX_FLAGS "-Wno-deprecated-declarations ${CMAKE_CXX_FLAGS}") | ||
|
||
find_package(Boost REQUIRED COMPONENTS program_options filesystem regex thread system) | ||
find_package(OpenSSL REQUIRED) | ||
find_package(ZLIB REQUIRED) | ||
find_package(ProtoBuf QUIET) | ||
if(NOT ProtoBuf_FOUND) | ||
find_library(PROTOBUF_LIBRARIES protobuf) | ||
endif() | ||
find_library(LOG4CXX_LIBRARY_PATH log4cxx) | ||
find_library(CURL_LIBRARY_PATH curl) | ||
find_path(LOG4CXX_INCLUDE_PATH log4cxx/logger.h) | ||
|
||
include_directories( | ||
${CMAKE_SOURCE_DIR} | ||
${CMAKE_SOURCE_DIR}/include | ||
${Boost_INCLUDE_DIR} | ||
${OPENSSL_INCLUDE_DIR} | ||
${ZLIB_INCLUDE_DIR} | ||
${PROTOBUF_INCLUDE_DIR} | ||
${LOG4CXX_INCLUDE_PATH} | ||
) | ||
|
||
set(COMMON_LIBS | ||
${COMMON_LIBS} | ||
${Boost_LIBRARIES} | ||
${OPENSSL_LIBRARIES} | ||
${ZLIB_LIBRARIES} | ||
${PROTOBUF_LIBRARIES} | ||
${LOG4CXX_LIBRARY_PATH} | ||
${CURL_LIBRARY_PATH} | ||
) | ||
|
||
link_directories(${CMAKE_BINARY_DIR}/lib) | ||
|
||
set(CLIENT_LIBS | ||
${COMMON_LIBS} | ||
pulsar | ||
) | ||
|
||
add_subdirectory(lib) | ||
add_subdirectory(perf) | ||
add_subdirectory(examples) | ||
add_subdirectory(tests) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
Pulsar C++ Client Library | ||
|
||
Copyright 2016 Yahoo Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
|
||
This product contain sources from LZ4 - Fast LZ compression algorithm: | ||
* Copyright (C) 2011-2015, Yann Collet. | ||
* LICENSE: BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) | ||
* HOMEPAGE: https://github.com/Cyan4973/lz4 | ||
|
||
|
||
This product contains sources from Circe CRC library: | ||
* Copyright 2014 Trevor Robinson | ||
* LICENSE : Apache License, Version 2.0 | ||
* HOMEPAGE: https://github.com/trevorr/circe | ||
|
||
This product contains sources from Adler CRC32c implementation: | ||
* Copyright (C) 2013 Mark Adler | ||
* LICENSE: ZLib License (https://opensource.org/licenses/Zlib) | ||
* HOMEPAGE: https://github.com/baruch/crcbench/blob/master/crc-mark-adler.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
### Pulsar C++ client library | ||
|
||
Examples for using the API to publish and consume messages can be found on | ||
https://github.com/yahoo/pulsar/tree/master/pulsar-client-cpp/examples | ||
|
||
#### Requirements | ||
|
||
* CMake | ||
* Boost | ||
* [Protocol Buffer 2.6](https://developers.google.com/protocol-buffers/) | ||
* [Log4CXX](https://logging.apache.org/log4cxx) | ||
* LibCurl | ||
* [GTest](https://github.com/google/googletest) | ||
|
||
|
||
#### Compile on Ubuntu Server 16.04 | ||
|
||
Install all dependencies: | ||
|
||
```shell | ||
apt-get install cmake libssl-dev libcurl4-openssl-dev liblog4cxx-dev \ | ||
libprotobuf-dev libboost-all-dev libgtest-dev | ||
``` | ||
|
||
Compile and install Google Test: | ||
|
||
```shell | ||
cd /usr/src/gtest | ||
sudo cmake . | ||
sudo make | ||
sudo cp *.a /usr/lib | ||
``` | ||
|
||
|
||
Compile Pulsar client library: | ||
|
||
```shell | ||
cd pulsar/pulsar-client-cpp | ||
cmake . | ||
make | ||
``` | ||
|
||
Client library will be placed in | ||
``` | ||
lib/libpulsar.so | ||
lib/libpulsar.a | ||
``` | ||
|
||
Tools : | ||
|
||
``` | ||
perf/perfProducer | ||
perf/perfConsumer | ||
``` | ||
|
||
Tests: | ||
|
||
``` | ||
1. Start the standalone pulsar | ||
export PULSAR_STANDALONE_CONF=tests/standalone.conf | ||
../bin/pulsar standalone | ||
2. Run tests | ||
tests/main | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2016 Yahoo Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
function usage() { | ||
echo "$0: <unpack location> <build directory> [all|dep|compile]"; | ||
echo " Unpack Location is used to store downloaded dependant packages"; | ||
echo " Build directory is pulsar base folder"; | ||
exit 1; | ||
} | ||
|
||
if [ $# -ne 3 ]; then | ||
usage | ||
fi | ||
|
||
if [ ! -d $1 ]; then | ||
echo "Unpack directory $1 does not exists" | ||
echo "" | ||
usage; | ||
fi | ||
|
||
if [ ! -d $2 ]; then | ||
echo "Build directory $2 does not exists" | ||
echo "" | ||
usage; | ||
fi | ||
|
||
if [ "$3" != "all" -a "$3" != "dep" -a "$3" != "compile" ]; then | ||
echo "Unknown command $3. Supported commands all|dep|compile"; | ||
echo "" | ||
usage; | ||
fi | ||
|
||
exec_cmd() { | ||
eval $* | ||
if [ $? -ne 0 ]; then | ||
echo "Command $* failed" | ||
usage | ||
fi | ||
return $! | ||
} | ||
|
||
if [ "$3" = "all" -o "$3" = "dep" ]; then | ||
# Install dependant packages | ||
exec_cmd "apt-get install -y cmake libssl-dev libcurl4-openssl-dev liblog4cxx10-dev libprotobuf-dev libboost1.55-all-dev libgtest-dev"; | ||
exec_cmd "pushd $1/ && wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz && popd"; | ||
exec_cmd "pushd /usr/src/gtest && cmake . && make && cp *.a /usr/lib && popd"; | ||
exec_cmd "pushd $1/ && tar xvfz $1/protobuf-2.6.1.tar.gz && pushd $1/protobuf-2.6.1 && ./configure && make && make install && popd && popd"; | ||
fi | ||
|
||
if [ "$3" = "all" -o "$3" = "compile" ]; then | ||
# Compile and run unit tests | ||
PULSAR_VERSION=`cat $2/pom.xml | grep -Po '(<?<version>)[^<]+' | sed 's/.*>//' | head -1`; | ||
exec_cmd "pushd $2/pulsar-client-cpp && PULSAR_VERSION=$PULSAR_VERSION cmake . && make && popd"; | ||
PULSAR_STANDALONE_CONF=$2/pulsar-client-cpp/tests/standalone.conf $2/bin/pulsar standalone & | ||
pid=$!; | ||
exec_cmd "sleep 10 && pushd $2/pulsar-client-cpp/tests && ./main && popd"; | ||
exec_cmd "kill -SIGTERM $pid"; | ||
fi |
Oops, something went wrong.