Skip to content

Commit

Permalink
Added pulsar C++ client (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
saandrews authored Feb 7, 2017
1 parent 295577c commit 77f1ce8
Show file tree
Hide file tree
Showing 146 changed files with 37,598 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@

language: java
language: java C++
jdk:
- oraclejdk8

cache:
directories:
- $HOME/.m2

- $HOME/pulsar-dep

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

install:
- sudo bash -x $TRAVIS_BUILD_DIR/pulsar-client-cpp/travis-build.sh $HOME/pulsar-dep $TRAVIS_BUILD_DIR dep

after_success:
- sudo bash -x $TRAVIS_BUILD_DIR/pulsar-client-cpp/travis-build.sh $HOME/pulsar-dep $TRAVIS_BUILD_DIR compile

deploy:
-
provider: script
Expand All @@ -27,6 +33,7 @@ deploy:
on:
tags: true
-

provider: releases
api_key:
secure: mIACMQlTzepBa9wWbKlME1Ig9/vKLHz63fn2zR2fbYjaAgXCPVe1lbTLbOZb62yB0XL7rUekyKIf0DEFH/cS1XjCb7aDKo4pLh6uiHdIIS8t1qEJJT54vbLwnWJXjo+14QHvaXgDlO/YoxpyOicrKI++b3fScD0zK2I8R6Lmwan/ZQze9uhRO0RKGChsDAszy+98C6JJxQXWQ0YjnUhwP5PtZX3Fm1rxtuCIk2Fl9gQdp9/j9U6vRKtWaO22Q2YaaaPGGoVyTwV6iMSOXDMb6zhjEQ3aiuJMJHUJRcGEU4fV7hkiUukWdo5+5C/mASNiJDYefG86KfCktMniPMzyAPXNc6hUzbOZuLNI1/f1QqBwzTJbH7NIUjz5f0hjNsHuYvkL8TcxE9pDA0Qkr8OIWR8M3+H7WKuiSTaVSeCobGBE8g6ymanlRvOQZblFpgw91B/KmZucsin0+rV5tVRlqTBYHL5f6fXEyhKdGYRiHaNR29mBBJsZng2tR6wVjPGqyEfdwFVOs44d2Rkt885VjZthap/Yw+SJKOvbJv1zaRglmbvbl629LvYOgT6ptYPDJyu/J/kzPrWnzvyTf72M6bR991Kx8gEkT4WRwCRBAuhg8i2bmIcsjbXtLcB0YRHgrBueJD0SuLREtcxJYvkgMI1UZon5UrCTkJDc0oFLO28=
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ flexible messaging model and an intuitive client API.</description>
<exclude>logs/**</exclude>
<exclude>**/*.versionsBackup</exclude>
<exclude>**/circe/**</exclude>
<exclude>pulsar-client-cpp/lib/checksum/int_types.h</exclude>
<exclude>pulsar-client-cpp/lib/checksum/crc32c*</exclude>
<exclude>pulsar-client-cpp/lib/lz4/lz4.*</exclude>
<exclude>pulsar-client-cpp/lib/PulsarApi.pb.*</exclude>
<exclude>pulsar-client-cpp/CMakeFiles/**</exclude>
</excludes>
<mapping>
<proto>JAVADOC_STYLE</proto>
Expand Down
58 changes: 58 additions & 0 deletions pulsar-client-cpp/.gitignore
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
65 changes: 65 additions & 0 deletions pulsar-client-cpp/CMakeLists.txt
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)
33 changes: 33 additions & 0 deletions pulsar-client-cpp/NOTICE
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
66 changes: 66 additions & 0 deletions pulsar-client-cpp/README.md
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
```
Loading

0 comments on commit 77f1ce8

Please sign in to comment.