Skip to content

Commit 77f1ce8

Browse files
authored
Added pulsar C++ client (#185)
1 parent 295577c commit 77f1ce8

File tree

146 files changed

+37598
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+37598
-2
lines changed

.travis.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11

2-
language: java
2+
language: java C++
33
jdk:
44
- oraclejdk8
55

66
cache:
77
directories:
88
- $HOME/.m2
9-
9+
- $HOME/pulsar-dep
1010

1111
# Reconstruct the gpg keys to sign the artifacts
1212
before_deploy:
1313
- echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import --batch || true
1414
- echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust --batch || true
1515

16+
install:
17+
- sudo bash -x $TRAVIS_BUILD_DIR/pulsar-client-cpp/travis-build.sh $HOME/pulsar-dep $TRAVIS_BUILD_DIR dep
18+
19+
after_success:
20+
- sudo bash -x $TRAVIS_BUILD_DIR/pulsar-client-cpp/travis-build.sh $HOME/pulsar-dep $TRAVIS_BUILD_DIR compile
21+
1622
deploy:
1723
-
1824
provider: script
@@ -27,6 +33,7 @@ deploy:
2733
on:
2834
tags: true
2935
-
36+
3037
provider: releases
3138
api_key:
3239
secure: mIACMQlTzepBa9wWbKlME1Ig9/vKLHz63fn2zR2fbYjaAgXCPVe1lbTLbOZb62yB0XL7rUekyKIf0DEFH/cS1XjCb7aDKo4pLh6uiHdIIS8t1qEJJT54vbLwnWJXjo+14QHvaXgDlO/YoxpyOicrKI++b3fScD0zK2I8R6Lmwan/ZQze9uhRO0RKGChsDAszy+98C6JJxQXWQ0YjnUhwP5PtZX3Fm1rxtuCIk2Fl9gQdp9/j9U6vRKtWaO22Q2YaaaPGGoVyTwV6iMSOXDMb6zhjEQ3aiuJMJHUJRcGEU4fV7hkiUukWdo5+5C/mASNiJDYefG86KfCktMniPMzyAPXNc6hUzbOZuLNI1/f1QqBwzTJbH7NIUjz5f0hjNsHuYvkL8TcxE9pDA0Qkr8OIWR8M3+H7WKuiSTaVSeCobGBE8g6ymanlRvOQZblFpgw91B/KmZucsin0+rV5tVRlqTBYHL5f6fXEyhKdGYRiHaNR29mBBJsZng2tR6wVjPGqyEfdwFVOs44d2Rkt885VjZthap/Yw+SJKOvbJv1zaRglmbvbl629LvYOgT6ptYPDJyu/J/kzPrWnzvyTf72M6bR991Kx8gEkT4WRwCRBAuhg8i2bmIcsjbXtLcB0YRHgrBueJD0SuLREtcxJYvkgMI1UZon5UrCTkJDc0oFLO28=

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,11 @@ flexible messaging model and an intuitive client API.</description>
466466
<exclude>logs/**</exclude>
467467
<exclude>**/*.versionsBackup</exclude>
468468
<exclude>**/circe/**</exclude>
469+
<exclude>pulsar-client-cpp/lib/checksum/int_types.h</exclude>
470+
<exclude>pulsar-client-cpp/lib/checksum/crc32c*</exclude>
471+
<exclude>pulsar-client-cpp/lib/lz4/lz4.*</exclude>
472+
<exclude>pulsar-client-cpp/lib/PulsarApi.pb.*</exclude>
473+
<exclude>pulsar-client-cpp/CMakeFiles/**</exclude>
469474
</excludes>
470475
<mapping>
471476
<proto>JAVADOC_STYLE</proto>

pulsar-client-cpp/.gitignore

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
*.obj
6+
*.os
7+
*.scons*
8+
9+
# Compiled Dynamic libraries
10+
*.so
11+
*.dylib
12+
*.dll
13+
*.so.1
14+
15+
# Compiled Static libraries
16+
*.lai
17+
*.la
18+
*.a
19+
*.lib
20+
21+
# Executables
22+
*.exe
23+
*.out
24+
*.app
25+
26+
# Dependency file
27+
*.d
28+
29+
# Mac swap file
30+
*.DS_Store
31+
32+
# Linux swap file
33+
*.swp
34+
35+
# Exclude compiled executables
36+
/examples/SampleProducer
37+
/examples/SampleConsumer
38+
/examples/SampleAsyncProducer
39+
/examples/SampleConsumerListener
40+
/tests/main
41+
/perf/PerfProducer
42+
/perf/PerfConsumer
43+
/system-test/SystemTest
44+
45+
# Eclipse generated files
46+
.cproject
47+
.project
48+
.settings/
49+
.pydevproject
50+
51+
# doxygen files
52+
apidocs/
53+
54+
# CMAKE
55+
Makefile
56+
cmake_install.cmake
57+
CMakeFiles
58+
CMakeCache.txt

pulsar-client-cpp/CMakeLists.txt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#
2+
# Copyright 2016 Yahoo Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
cmake_minimum_required(VERSION 2.8)
18+
project (pulsar-cpp)
19+
20+
set(Boost_NO_BOOST_CMAKE ON)
21+
22+
set (CMAKE_CXX_FLAGS "-Wno-deprecated-declarations ${CMAKE_CXX_FLAGS}")
23+
24+
find_package(Boost REQUIRED COMPONENTS program_options filesystem regex thread system)
25+
find_package(OpenSSL REQUIRED)
26+
find_package(ZLIB REQUIRED)
27+
find_package(ProtoBuf QUIET)
28+
if(NOT ProtoBuf_FOUND)
29+
find_library(PROTOBUF_LIBRARIES protobuf)
30+
endif()
31+
find_library(LOG4CXX_LIBRARY_PATH log4cxx)
32+
find_library(CURL_LIBRARY_PATH curl)
33+
find_path(LOG4CXX_INCLUDE_PATH log4cxx/logger.h)
34+
35+
include_directories(
36+
${CMAKE_SOURCE_DIR}
37+
${CMAKE_SOURCE_DIR}/include
38+
${Boost_INCLUDE_DIR}
39+
${OPENSSL_INCLUDE_DIR}
40+
${ZLIB_INCLUDE_DIR}
41+
${PROTOBUF_INCLUDE_DIR}
42+
${LOG4CXX_INCLUDE_PATH}
43+
)
44+
45+
set(COMMON_LIBS
46+
${COMMON_LIBS}
47+
${Boost_LIBRARIES}
48+
${OPENSSL_LIBRARIES}
49+
${ZLIB_LIBRARIES}
50+
${PROTOBUF_LIBRARIES}
51+
${LOG4CXX_LIBRARY_PATH}
52+
${CURL_LIBRARY_PATH}
53+
)
54+
55+
link_directories(${CMAKE_BINARY_DIR}/lib)
56+
57+
set(CLIENT_LIBS
58+
${COMMON_LIBS}
59+
pulsar
60+
)
61+
62+
add_subdirectory(lib)
63+
add_subdirectory(perf)
64+
add_subdirectory(examples)
65+
add_subdirectory(tests)

pulsar-client-cpp/NOTICE

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
Pulsar C++ Client Library
3+
4+
Copyright 2016 Yahoo Inc.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
19+
This product contain sources from LZ4 - Fast LZ compression algorithm:
20+
* Copyright (C) 2011-2015, Yann Collet.
21+
* LICENSE: BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
22+
* HOMEPAGE: https://github.com/Cyan4973/lz4
23+
24+
25+
This product contains sources from Circe CRC library:
26+
* Copyright 2014 Trevor Robinson
27+
* LICENSE : Apache License, Version 2.0
28+
* HOMEPAGE: https://github.com/trevorr/circe
29+
30+
This product contains sources from Adler CRC32c implementation:
31+
* Copyright (C) 2013 Mark Adler
32+
* LICENSE: ZLib License (https://opensource.org/licenses/Zlib)
33+
* HOMEPAGE: https://github.com/baruch/crcbench/blob/master/crc-mark-adler.c

pulsar-client-cpp/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
### Pulsar C++ client library
3+
4+
Examples for using the API to publish and consume messages can be found on
5+
https://github.com/yahoo/pulsar/tree/master/pulsar-client-cpp/examples
6+
7+
#### Requirements
8+
9+
* CMake
10+
* Boost
11+
* [Protocol Buffer 2.6](https://developers.google.com/protocol-buffers/)
12+
* [Log4CXX](https://logging.apache.org/log4cxx)
13+
* LibCurl
14+
* [GTest](https://github.com/google/googletest)
15+
16+
17+
#### Compile on Ubuntu Server 16.04
18+
19+
Install all dependencies:
20+
21+
```shell
22+
apt-get install cmake libssl-dev libcurl4-openssl-dev liblog4cxx-dev \
23+
libprotobuf-dev libboost-all-dev libgtest-dev
24+
```
25+
26+
Compile and install Google Test:
27+
28+
```shell
29+
cd /usr/src/gtest
30+
sudo cmake .
31+
sudo make
32+
sudo cp *.a /usr/lib
33+
```
34+
35+
36+
Compile Pulsar client library:
37+
38+
```shell
39+
cd pulsar/pulsar-client-cpp
40+
cmake .
41+
make
42+
```
43+
44+
Client library will be placed in
45+
```
46+
lib/libpulsar.so
47+
lib/libpulsar.a
48+
```
49+
50+
Tools :
51+
52+
```
53+
perf/perfProducer
54+
perf/perfConsumer
55+
```
56+
57+
Tests:
58+
59+
```
60+
1. Start the standalone pulsar
61+
export PULSAR_STANDALONE_CONF=tests/standalone.conf
62+
../bin/pulsar standalone
63+
64+
2. Run tests
65+
tests/main
66+
```

0 commit comments

Comments
 (0)