From 5ab25011ef80ffd892e2061bf4d10bfc00fd8a7a Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Wed, 23 Nov 2022 15:37:07 +0800 Subject: [PATCH 1/6] [doc] Add documents for C++ client 3.0.0 or later --- site2/docs/client-libraries-cpp.md | 44 +++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/site2/docs/client-libraries-cpp.md b/site2/docs/client-libraries-cpp.md index 11ae9383d7845..3a448d8e72162 100644 --- a/site2/docs/client-libraries-cpp.md +++ b/site2/docs/client-libraries-cpp.md @@ -11,6 +11,41 @@ import TabItem from '@theme/TabItem'; You can use a Pulsar C++ client to create producers, consumers, and readers. For Pulsar features that C++ clients support, see [Client Feature Matrix](https://docs.google.com/spreadsheets/d/1YHYTkIXR8-Ql103u-IMI18TXLlGStK8uJjDsOOA0T20/edit#gid=1784579914). For complete examples, refer to [C++ client examples](https://github.com/apache/pulsar-client-cpp/tree/main/examples). +## Version 3.0.0 or later + +The version of the Pulsar C++ client is no longer consistent with Pulsar after 2.10.x. The new client version starts from 3.0.0. You can turn to [the download page](https://pulsar.apache.org/download) to see the latest releases. + +Take the [3.0.0 release](https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.0.0/) for example, there are following subdirectories: +- apk-arm64: the Alpine Linux packages for ARM64 architectures +- apk-x86_64: the Alpine Linux packages for x64 architectures +- deb-arm64: the Debian-based Linux packages for ARM64 architectures +- deb-x86_64: the Debian-based Linux packages for x64 architectures +- rpm-arm64: the RedHat-based Linux packages for ARM64 architectures +- rpm-x86_64: the RedHat-based Linux packages for x64 architectures + +These Linux packages above all contain the C++ headers installed under `/usr/include` and the following libraries installed under `/usr/lib`: +- libpulsar.so: the shared library that links 3rd party dependencies statically +- libpulsar.a: the static library +- libpulsarwithdeps.a: the fat static library that includes all 3rd party dependencies + +Here is an example to link these libraries for a C++ source file named `main.cc`: + +```bash +# Link to libpulsar.so +g++ -std=c++11 main.cc -lpulsar +# Link to libpulsarwithdeps.a +g++ -std=c++11 main.cc /usr/lib/libpulsarwithdeps.a -lpthread -ldl +# Link to libpulsar.a +g++ -std=c++11 main.cc /usr/lib/libpulsar.a \ + -lprotobuf -lcurl -lssl -lcrypto -lz -lzstd -lsnappy -lpthread -ldl +``` + +> **NOTE** +> +> Linking to `libpulsar.a` might be difficult for beginners because the 3rd party dependencies must be compatible. For example, the protobuf version must be 3.20.0 or higher for Pulsar C++ client 3.0.0. It's better to link to `libpulsarwithdeps.a` instead. +> +> Before 3.0.0, there was a `libpulsarnossl.so`, which is removed now. + ## Installation Use one of the following methods to install a Pulsar C++ client. @@ -104,6 +139,13 @@ If you get an error like "libpulsar.so: cannot open shared object file: No such ::: +### APK + +```bash +apk add --allow-untrusted ./apache-pulsar-client-3.0.0-r0.apk +apk add --allow-untrusted ./apache-pulsar-client-dev-3.0.0-r0.apk +``` + ## Connection URLs To connect to Pulsar using client libraries, you need to specify a [Pulsar protocol](developing-binary-protocol.md) URL. @@ -398,4 +440,4 @@ client.subscribe("my-topic", "my-sub", conf, consumer); ## Schema -To work with [Pulsar schema](schema-overview.md) using C++ clients, see [Schema - Get started](schema-get-started.md). For specific schema types that C++ clients support, see [code](https://github.com/apache/pulsar-client-cpp/blob/main/include/pulsar/Schema.h). \ No newline at end of file +To work with [Pulsar schema](schema-overview.md) using C++ clients, see [Schema - Get started](schema-get-started.md). For specific schema types that C++ clients support, see [code](https://github.com/apache/pulsar-client-cpp/blob/main/include/pulsar/Schema.h). From 7d26870df7cc9ff916e434b5287dfc902a4ce2b4 Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Wed, 23 Nov 2022 20:25:19 +0800 Subject: [PATCH 2/6] Use admonition Co-authored-by: tison --- site2/docs/client-libraries-cpp.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/site2/docs/client-libraries-cpp.md b/site2/docs/client-libraries-cpp.md index 3a448d8e72162..dbedcdba4a99f 100644 --- a/site2/docs/client-libraries-cpp.md +++ b/site2/docs/client-libraries-cpp.md @@ -40,10 +40,11 @@ g++ -std=c++11 main.cc /usr/lib/libpulsar.a \ -lprotobuf -lcurl -lssl -lcrypto -lz -lzstd -lsnappy -lpthread -ldl ``` -> **NOTE** -> -> Linking to `libpulsar.a` might be difficult for beginners because the 3rd party dependencies must be compatible. For example, the protobuf version must be 3.20.0 or higher for Pulsar C++ client 3.0.0. It's better to link to `libpulsarwithdeps.a` instead. -> +:::caution + +Linking to `libpulsar.a` can be difficult for beginners because the 3rd party dependencies must be compatible. For example, the protobuf version must be 3.20.0 or higher for Pulsar C++ client 3.0.0. It's better to link to `libpulsarwithdeps.a` instead. + +::: > Before 3.0.0, there was a `libpulsarnossl.so`, which is removed now. ## Installation From 482941b6d534e3c25f0421b3ba2c893ccc588b63 Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Wed, 23 Nov 2022 20:26:03 +0800 Subject: [PATCH 3/6] Update site2/docs/client-libraries-cpp.md Co-authored-by: momo-jun <60642177+momo-jun@users.noreply.github.com> --- site2/docs/client-libraries-cpp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site2/docs/client-libraries-cpp.md b/site2/docs/client-libraries-cpp.md index dbedcdba4a99f..6944416aa089a 100644 --- a/site2/docs/client-libraries-cpp.md +++ b/site2/docs/client-libraries-cpp.md @@ -13,7 +13,7 @@ You can use a Pulsar C++ client to create producers, consumers, and readers. For ## Version 3.0.0 or later -The version of the Pulsar C++ client is no longer consistent with Pulsar after 2.10.x. The new client version starts from 3.0.0. You can turn to [the download page](https://pulsar.apache.org/download) to see the latest releases. +The new version of the Pulsar C++ client starts from 3.0.0 and has been no longer consistent with Pulsar since 2.10.x. For the latest releases, see the [Download](/download/) page. Take the [3.0.0 release](https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.0.0/) for example, there are following subdirectories: - apk-arm64: the Alpine Linux packages for ARM64 architectures From a3fd00a23b11bd60bb4287ae045e132a31d2dd2b Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Wed, 23 Nov 2022 20:28:22 +0800 Subject: [PATCH 4/6] Update site2/docs/client-libraries-cpp.md Co-authored-by: momo-jun <60642177+momo-jun@users.noreply.github.com> --- site2/docs/client-libraries-cpp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site2/docs/client-libraries-cpp.md b/site2/docs/client-libraries-cpp.md index 6944416aa089a..16ab2bdbf1e82 100644 --- a/site2/docs/client-libraries-cpp.md +++ b/site2/docs/client-libraries-cpp.md @@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'; You can use a Pulsar C++ client to create producers, consumers, and readers. For Pulsar features that C++ clients support, see [Client Feature Matrix](https://docs.google.com/spreadsheets/d/1YHYTkIXR8-Ql103u-IMI18TXLlGStK8uJjDsOOA0T20/edit#gid=1784579914). For complete examples, refer to [C++ client examples](https://github.com/apache/pulsar-client-cpp/tree/main/examples). -## Version 3.0.0 or later +## Changes for version 3.0.0 or later The new version of the Pulsar C++ client starts from 3.0.0 and has been no longer consistent with Pulsar since 2.10.x. For the latest releases, see the [Download](/download/) page. From 32a24b268e21fc65699db7a96e0a4217130f9009 Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Wed, 23 Nov 2022 20:30:05 +0800 Subject: [PATCH 5/6] Update site2/docs/client-libraries-cpp.md Co-authored-by: tison --- site2/docs/client-libraries-cpp.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/site2/docs/client-libraries-cpp.md b/site2/docs/client-libraries-cpp.md index 16ab2bdbf1e82..20e4a150aedc4 100644 --- a/site2/docs/client-libraries-cpp.md +++ b/site2/docs/client-libraries-cpp.md @@ -45,7 +45,12 @@ g++ -std=c++11 main.cc /usr/lib/libpulsar.a \ Linking to `libpulsar.a` can be difficult for beginners because the 3rd party dependencies must be compatible. For example, the protobuf version must be 3.20.0 or higher for Pulsar C++ client 3.0.0. It's better to link to `libpulsarwithdeps.a` instead. ::: -> Before 3.0.0, there was a `libpulsarnossl.so`, which is removed now. + +:::danger + +Before 3.0.0, there was a `libpulsarnossl.so`, which is removed now. + +::: ## Installation From 0e9b95ced0df448610cdcad977c3630de26f7fe4 Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Wed, 23 Nov 2022 20:43:54 +0800 Subject: [PATCH 6/6] Use wildcard in APK installation --- site2/docs/client-libraries-cpp.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/site2/docs/client-libraries-cpp.md b/site2/docs/client-libraries-cpp.md index 20e4a150aedc4..29ae1d530137a 100644 --- a/site2/docs/client-libraries-cpp.md +++ b/site2/docs/client-libraries-cpp.md @@ -148,8 +148,7 @@ If you get an error like "libpulsar.so: cannot open shared object file: No such ### APK ```bash -apk add --allow-untrusted ./apache-pulsar-client-3.0.0-r0.apk -apk add --allow-untrusted ./apache-pulsar-client-dev-3.0.0-r0.apk +apk add --allow-untrusted ./apache-pulsar-client-*.apk ``` ## Connection URLs