-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added pulsar C++ client #185
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that would be good to have is to get Pulsar version from the top level pom and add that as a compiler macro definition. This way the client will be able to report its own version to the broker (same as Java client).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed it in lib/CMakeLists.txt