Skip to content

Commit

Permalink
[Docs]Update docs for Client libraries C++ (apache#12220)
Browse files Browse the repository at this point in the history
* Update client-libraries-cpp.md

* Update client-libraries-cpp.md

* Update client-libraries-cpp.md

* Update client-libraries-cpp.md

* Update client-libraries-cpp.md
  • Loading branch information
fengtao1998 authored Sep 29, 2021
1 parent 3ec3665 commit 879e93d
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 69 deletions.
17 changes: 11 additions & 6 deletions site2/docs/client-libraries-cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All the methods in producer, consumer, and reader of a C++ client are thread-saf

## Supported platforms

Pulsar C++ client is supported on **Linux** and **MacOS** platforms.
Pulsar C++ client is supported on **Linux** ,**MacOS** and **Windows** platforms.

[Doxygen](http://www.doxygen.nl/)-generated API docs for the C++ client are available [here](/api/cpp).

Expand Down Expand Up @@ -258,6 +258,11 @@ cmake -B ./build -A x64 -DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF -DVCPKG_TRI
cmake --build ./build --config Release
```

> **NOTE**
>
> 1. For Windows 32-bit, you need to use `-A Win32` and `-DVCPKG_TRIPLET=x86-windows`.
> 2. For MSVC Debug mode, you need to replace `Release` with `Debug` for both `CMAKE_BUILD_TYPE` variable and `--config` option.
4. Client libraries are available in the following places.

```
Expand Down Expand Up @@ -288,8 +293,8 @@ pulsar+ssl://pulsar.us-west.example.com:6651
## Create a consumer

To use Pulsar as a consumer, you need to create a consumer on the C++ client. There are two main ways of using the consumer:
- Blocking style: synchronously calling `receive(msg)`.
- Non-blocking (event based) style: using a message listener.
- [Blocking style](#blocking-example): synchronously calling `receive(msg)`.
- [Non-blocking](#consumer-with-a-message-listener) (event based) style: using a message listener.

### Blocking example

Expand Down Expand Up @@ -335,7 +340,7 @@ int main() {

### Consumer with a message listener

We can avoid the need to run a loop with blocking calls with an event based style by using a message listener which is invoked for each message that is received.
You can avoid running a loop with blocking calls with an event based style by using a message listener which is invoked for each message that is received.

This example starts a subscription at the earliest offset and consumes 100 messages.

Expand Down Expand Up @@ -386,8 +391,8 @@ int main() {
## Create a producer
To use Pulsar as a producer, you need to create a producer on the C++ client. There are two main ways of using a producer:
- Blocking style where each call to `send` waits for an ack from the broker.
- Non-blocking asynchronous style where `sendAsync` is called instead of `send` and a callback is supplied for when the ack is received from the broker.
- [Blocking style](#simple-blocking-example) : each call to `send` waits for an ack from the broker.
- [Non-blocking asynchronous style](#non-blocking-example) : `sendAsync` is called instead of `send` and a callback is supplied for when the ack is received from the broker.
### Simple blocking example
Expand Down
Loading

0 comments on commit 879e93d

Please sign in to comment.