This is an automated email from the ASF dual-hosted git repository.

baodi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 9bfa32e0a58 Add CPP client table view doc. (#565)
9bfa32e0a58 is described below

commit 9bfa32e0a585b83ba6205988a5fa734ee73b8ca4
Author: Baodi Shi <[email protected]>
AuthorDate: Mon May 22 08:46:50 2023 +0800

    Add CPP client table view doc. (#565)
    
    * Add CPP client table view doc.
    
    * Update docs/client-libraries-tableviews.md
    
    Co-authored-by: Jun Ma <[email protected]>
    
    * Apply suggestions from code review
    
    Co-authored-by: Anonymitaet <[email protected]>
    
    * Update docs/client-libraries-tableviews.md
    
    Co-authored-by: tison <[email protected]>
    
    ---------
    
    Co-authored-by: Jun Ma <[email protected]>
    Co-authored-by: Anonymitaet <[email protected]>
    Co-authored-by: tison <[email protected]>
---
 docs/client-libraries-tableviews.md | 106 ++++++++++++++++++++++++++++++------
 1 file changed, 88 insertions(+), 18 deletions(-)

diff --git a/docs/client-libraries-tableviews.md 
b/docs/client-libraries-tableviews.md
index 5ac0efbab11..6fa32e31081 100644
--- a/docs/client-libraries-tableviews.md
+++ b/docs/client-libraries-tableviews.md
@@ -4,25 +4,69 @@ title: Work with TableView
 sidebar_label: "Work with TableView"
 ---
 
+````mdx-code-block
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+````
+
 After setting up your clients, you can explore more to start working with 
[TableView](concepts-clients.md#tableview).
 
 ## Configure TableView
 
-The following is an example of how to configure a TableView.
 
-```java
-TableView<String> tv = client.newTableViewBuilder(Schema.STRING)
-  .topic("my-tableview")
-  .create()
-```
+````mdx-code-block
+<Tabs groupId="lang-choice"
+defaultValue="Java"
+values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"}]}>
+<TabItem value="Java">
+
+  The following is an example of how to configure a TableView.
+  
+  ```java
+    TableView<String> tv = client.newTableViewBuilder(Schema.STRING)
+    .topic("my-tableview")
+    .create()
+  ```
+
+You can use the available parameters in the `loadConf` configuration or the 
API 
[`TableViewBuilder`](/api/client/org/apache/pulsar/client/api/TableViewBuilder.html)
 to customize your TableView.
+
+  | Name | Type| Required? |  <div>Description</div> | Default
+  |---|---|---|---|---
+  | `topic` | string | yes | The topic name of the TableView. | N/A
+  | `autoUpdatePartitionInterval` | int | no | The interval to check for newly 
added partitions. | 60 (seconds)
+  | `subscriptionName` | string | no | The subscription name of the TableView. 
| null
+
+</TabItem>
+
+<TabItem value="C++">
+
+
+  This feature is supported in C++ client 3.2.0 or later versions.
+
+
+  ```cpp
+  ClientConfiguration clientConfiguration;
+  clientConfiguration.setPartititionsUpdateInterval(100);
+  Client client("pulsar://localhost:6650", clientConfiguration);
+  TableViewConfiguration tableViewConfiguration{schemaInfo, 
"test-subscription-name"};
+  TableView tableView;
+  client.createTableView("my-tableview", tableViewConfiguration, tableView)
+  ```
+
+  You can use the following parameters to customize your TableView.
+
+  | Name | Type| Required? |  <div>Description</div> | Default
+  |---|---|---|---|---
+  | `topic` | string | yes | The topic name of the TableView. | N/A
+  | `schemaInfo` | struct | no | Declare the schema of the data that this 
TableView can accept. The schema is checked against the schema of the topic, 
and the TableView creation fails if it's incompatible. | N/A
+  | `subscriptionName` | string | no | The subscription name of the TableView. 
| reader-{random string}
+  | `partititionsUpdateInterval` | int | no | Topic partitions update interval 
in seconds. In the C++ client, `partititionsUpdateInterval` is global within 
the same client.  | 60
 
-You can use the available parameters in the `loadConf` configuration or 
related 
[API](/api/client/2.10.0-SNAPSHOT/org/apache/pulsar/client/api/TableViewBuilder.html)
 to customize your TableView.
 
-| Name | Type| Required? |  <div>Description</div> | Default
-|---|---|---|---|---
-| `topic` | string | yes | The topic name of the TableView. | N/A
-| `autoUpdatePartitionInterval` | int | no | The interval to check for newly 
added partitions. | 60 (seconds)
-| `subscriptionName` | string | no | The subscription name of the TableView. | 
null
+</TabItem>
+
+</Tabs>
+````
 
 ## Register listeners
 
@@ -30,10 +74,36 @@ You can register listeners for both existing messages on a 
topic and new message
 
 The following is an example of how to register listeners with TableView.
 
-```java
-// Register listeners for all existing and incoming messages
-tv.forEachAndListen((key, value) -> /*operations on all existing and incoming 
messages*/)
 
-// Register action for all existing messages
-tv.forEach((key, value) -> /*operations on all existing messages*/)
-```
+````mdx-code-block
+<Tabs groupId="lang-choice"
+defaultValue="Java"
+values={[{"label":"Java","value":"Java"},{"label":"C++","value":"C++"}]}>
+
+<TabItem value="Java">
+
+  ```java
+  // Register listeners for all existing and incoming messages
+  tv.forEachAndListen((key, value) -> /*operations on all existing and 
incoming messages*/)
+
+  // Register actions for all existing messages
+  tv.forEach((key, value) -> /*operations on all existing messages*/)
+  ```
+
+</TabItem>
+
+
+<TabItem value="C++">
+
+    ```cpp
+    // Register listeners for all existing and incoming messages
+    tableView.forEach([](const std::string& key, const std::string& value) {});
+
+    // Register actions for all existing messages
+    tableView.forEachAndListen([](const std::string& key, const std::string& 
value) {});
+    ```
+
+</TabItem>
+
+</Tabs>
+````
\ No newline at end of file

Reply via email to