You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ur...@apache.org on 2022/10/20 06:06:31 UTC

[pulsar-site] branch main updated: Docs sync done from apache/pulsar(#e5b3ffd)

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

urfree 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 393b01f5b59 Docs sync done from apache/pulsar(#e5b3ffd)
393b01f5b59 is described below

commit 393b01f5b5902debcdb90cead8e9f693abc17ade
Author: Pulsar Site Updater <de...@pulsar.apache.org>
AuthorDate: Thu Oct 20 06:06:25 2022 +0000

    Docs sync done from apache/pulsar(#e5b3ffd)
---
 .../docs/client-libraries-websocket.md             |  9 ++--
 site2/website-next/docs/concepts-messaging.md      | 19 ++++----
 site2/website-next/docs/reference-pulsar-admin.md  | 18 ++++++++
 site2/website-next/docs/security-tls-transport.md  | 51 +++++++++++++++++++++-
 4 files changed, 82 insertions(+), 15 deletions(-)

diff --git a/site2/website-next/docs/client-libraries-websocket.md b/site2/website-next/docs/client-libraries-websocket.md
index 9060da9df27..c154961be06 100644
--- a/site2/website-next/docs/client-libraries-websocket.md
+++ b/site2/website-next/docs/client-libraries-websocket.md
@@ -44,7 +44,7 @@ clusterName=my-cluster
 
 ### Security settings
 
-To enable TLS encryption on WebSocket service:
+To enable TLS encryption on WebSocket service, configure the following parameters in the `conf/broker.conf` file.
 
 ```properties
 tlsEnabled=true
@@ -368,9 +368,8 @@ Key | Type | Required? | Explanation
 
 #### Acknowledging the message
 
-**In WebSocket**, Reader needs to acknowledge the successful processing of the message to
-have the Pulsar WebSocket service update the number of pending messages.
-If you don't send acknowledgments, Pulsar WebSocket service will stop sending messages after reaching the pendingMessages limit.
+**In WebSocket**, Reader needs to acknowledge the successful processing of the message to have the Pulsar WebSocket service update the number of pending messages.
+If you don't send acknowledgments, Pulsar WebSocket service will stop sending messages after reaching the `pendingMessages` limit.
 
 ```json
 {
@@ -384,7 +383,7 @@ Key | Type | Required? | Explanation
 
 #### Check if reach the end of topic
 
-Consumers can check if it has reached the end of topic by sending the `isEndOfTopic` request.
+Consumers can check if it has reached the end of a topic by sending the `isEndOfTopic` request.
 
 **Request**
 
diff --git a/site2/website-next/docs/concepts-messaging.md b/site2/website-next/docs/concepts-messaging.md
index dd762d0f75d..617982393ac 100644
--- a/site2/website-next/docs/concepts-messaging.md
+++ b/site2/website-next/docs/concepts-messaging.md
@@ -437,8 +437,7 @@ consumer.reconsumeLater(msg, customProperties, 3, TimeUnit.SECONDS);
 :::note
 
 *  Currently, retry letter topic is enabled in Shared subscription types.
-*  Compared with negativ![pub-sub-border](https://user-images.githubusercontent.com/94193423/192618897-460a10de-db92-4d43-b38c-59faffaa8044.svg)
-e acknowledgment, retry letter topic is more suitable for messages that require a large number of retries with a configurable retry interval. Because messages in the retry letter topic are persisted to BookKeeper, while messages that need to be retried due to negative acknowledgment are cached on the client side.
+*  Compared with negative acknowledgment, retry letter topic is more suitable for messages that require a large number of retries with a configurable retry interval. Because messages in the retry letter topic are persisted to BookKeeper, while messages that need to be retried due to negative acknowledgment are cached on the client side.
 
 :::
 
@@ -552,7 +551,7 @@ When a subscription has no consumers, its subscription type is undefined. The ty
 
 In the *Exclusive* type, only a single consumer is allowed to attach to the subscription. If multiple consumers subscribe to a topic using the same subscription, an error occurs. Note that if the topic is partitioned, all partitions will be consumed by the single consumer allowed to be connected to the subscription.
 
-In the diagram below, only **Consumer A-0** is allowed to consume messages.
+In the diagram below, only **Consumer A** is allowed to consume messages.
 
 :::tip
 
@@ -571,7 +570,7 @@ In the *Failover* type, multiple consumers can attach to the same subscription.
 
 For example, a partitioned topic has 3 partitions, and 15 consumers. Each partition will have 1 active consumer and 4 stand-by consumers.
 
-In the diagram below, **Consumer-B-0** is the master consumer while **Consumer-B-1** would be the next consumer in line to receive messages if **Consumer-B-0** is disconnected.
+In the diagram below, **Consumer A** is the master consumer while **Consumer B** would be the next consumer in line to receive messages if **Consumer B** is disconnected.
 
 ![Failover subscriptions](/assets/pulsar-failover-subscriptions.svg)
 
@@ -579,7 +578,7 @@ In the diagram below, **Consumer-B-0** is the master consumer while **Consumer-B
 
 In *shared* or *round robin* type, multiple consumers can attach to the same subscription. Messages are delivered in a round-robin distribution across consumers, and any given message is delivered to only one consumer. When a consumer disconnects, all the messages that were sent to it and not acknowledged will be rescheduled for sending to the remaining consumers.
 
-In the diagram below, **Consumer-C-1** and **Consumer-C-2** are able to subscribe to the topic, but **Consumer-C-3** and others could as well.
+In the diagram below, **Consumer A**, **Consumer B** and **Consumer C** are all able to subscribe to the topic.
 
 :::note
 
@@ -598,7 +597,12 @@ In the *Key_Shared* type, multiple consumers can attach to the same subscription
 
 ![Key_Shared subscriptions](/assets/pulsar-key-shared-subscriptions.svg)
 
-Note that when the consumers are using the Key_Shared subscription type, you need to **disable batching** or **use key-based batching** for the producers. There are two reasons why the key-based batching is necessary for the Key_Shared subscription type:
+:::note
+
+When the consumers are using the Key_Shared subscription type, you need to **disable batching** or **use key-based batching** for the producers. 
+:::
+
+There are two reasons why the key-based batching is necessary for the Key_Shared subscription type:
 1. The broker dispatches messages according to the keys of the messages, but the default batching approach might fail to pack the messages with the same key to the same batch.
 2. Since it is the consumers instead of the broker who dispatch the messages from the batches, the key of the first message in one batch is considered as the key to all messages in this batch, thereby leading to context errors.
 
@@ -933,8 +937,7 @@ All message retention and expiry are managed at the [namespace](#namespaces) lev
 
 ![Message retention and expiry](/assets/retention-expiry.svg)
 
-With message retention, shown at the top, a <span style={{color: " #89b557"}}>retention policy</span> applied to all topics in a namespace dictates that some messages are durably stored in Pulsar even thoug![batching](https://user-images.githubusercontent.com/94193423/192618946-306d7d9c-a88f-45bd-8106-c5f2ca602ca6.svg)
-h they've already been acknowledged. Acknowledged messages that are not covered by the retention policy are <span style={{color: " #bb3b3e"}}>deleted</span>. Without a retention policy, *all* of the <span style={{color: " #19967d"}}>acknowledged messages</span> would be deleted.
+With message retention, shown at the top, a <span style={{color: " #89b557"}}>retention policy</span> applied to all topics in a namespace dictates that some messages are durably stored in Pulsar even though they've already been acknowledged. Acknowledged messages that are not covered by the retention policy are <span style={{color: " #bb3b3e"}}>deleted</span>. Without a retention policy, all of the <span style={{color: " #19967d"}}>acknowledged messages</span> would be deleted.
 
 With message expiry, shown at the bottom, some messages are <span style={{color: " #bb3b3e"}}>deleted</span>, even though they <span style={{color: " #337db6"}}>haven't been acknowledged</span>, because they've expired according to the <span style={{color: " #e39441"}}>TTL applied to the namespace</span> (for example because a TTL of 5 minutes has been applied and the messages haven't been acknowledged but are 10 minutes old).
 
diff --git a/site2/website-next/docs/reference-pulsar-admin.md b/site2/website-next/docs/reference-pulsar-admin.md
index cbd4005eaa3..61151824195 100644
--- a/site2/website-next/docs/reference-pulsar-admin.md
+++ b/site2/website-next/docs/reference-pulsar-admin.md
@@ -321,6 +321,24 @@ Options
 |`--url`|service-url||
 |`--url-secure`|service-url for secure connection||
 
+### `update cluster migration`
+Update the configuration for a cluster
+
+Usage
+
+```bash
+pulsar-admin clusters update-cluster-migration cluster-name options
+```
+
+Options
+
+|Flag|Description|Default|
+|---|---|---|
+|`--migrated`|Is cluster migrated.||
+|`--broker-url`|New cluster URL for the broker service.||
+|`--broker-url-secure`|New cluster service URL for a secure connection||
+|`--url`|service-url||
+|`--url-secure`|service-url for secure connection||
 
 ### `delete`
 Deletes an existing cluster
diff --git a/site2/website-next/docs/security-tls-transport.md b/site2/website-next/docs/security-tls-transport.md
index 05970834304..57e0dcaa96d 100644
--- a/site2/website-next/docs/security-tls-transport.md
+++ b/site2/website-next/docs/security-tls-transport.md
@@ -246,12 +246,12 @@ To enable TLS encryption, you need to configure the clients to use `https://` wi
 
 As the server certificate that you generated above does not belong to any of the default trust chains, you also need to either specify the path of the **trust cert** (recommended) or enable the clients to allow untrusted server certs.
 
-The following examples show how to configure TLS encryption for Java/Python/C++/Node.js/C# clients.
+The following examples show how to configure TLS encryption for Java/Python/C++/Node.js/C#/WebSocket clients.
 
 ````mdx-code-block
 <Tabs groupId="lang-choice"
   defaultValue="Java"
-  values={[{"label":"Java","value":"Java"},{"label":"Python","value":"Python"},{"label":"C++","value":"C++"},{"label":"Node.js","value":"Node.js"},{"label":"C#","value":"C#"}]}>
+  values={[{"label":"Java","value":"Java"},{"label":"Python","value":"Python"},{"label":"C++","value":"C++"},{"label":"Node.js","value":"Node.js"},{"label":"C#","value":"C#"},{"label":"WebSocket API","value":"WebSocket API"}]}>
 <TabItem value="Java">
 
 ```java
@@ -324,6 +324,53 @@ var client = PulsarClient.Builder()
 
 > Note that `VerifyCertificateName` refers to the configuration of hostname verification in the C# client.
 
+</TabItem>
+<TabItem value="WebSocket API">
+
+```python
+import websockets
+import asyncio
+import base64
+import json
+import ssl
+import pathlib
+
+ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+client_cert_pem = pathlib.Path(__file__).with_name("client.cert.pem")
+client_key_pem = pathlib.Path(__file__).with_name("client.key.pem")
+ca_cert_pem = pathlib.Path(__file__).with_name("ca.cert.pem")
+ssl_context.load_cert_chain(certfile=client_cert_pem, keyfile=client_key_pem)
+ssl_context.load_verify_locations(ca_cert_pem)
+# websocket producer uri wss, not ws
+uri = "wss://localhost:8080/ws/v2/producer/persistent/public/default/testtopic"
+client_pem = pathlib.Path(__file__).with_name("pulsar_client.pem")
+ssl_context.load_verify_locations(client_pem)
+# websocket producer uri wss, not ws
+uri = "wss://localhost:8080/ws/v2/producer/persistent/public/default/testtopic"
+# encode message
+s = "Hello World"
+firstEncoded = s.encode("UTF-8")
+binaryEncoded = base64.b64encode(firstEncoded)
+payloadString = binaryEncoded.decode('UTF-8')
+async def producer_handler(websocket):
+    await websocket.send(json.dumps({
+            'payload' : payloadString,
+            'properties': {
+                'key1' : 'value1',
+                'key2' : 'value2'
+            },
+            'context' : 5
+        }))
+async def test():
+    async with websockets.connect(uri) as websocket:
+        await producer_handler(websocket)
+        message = await websocket.recv()
+        print(f"< {message}")
+asyncio.run(test())
+```
+
+> Note that in addition to the required configurations in the `conf/client.conf` file, you need to configure more parameters in the `conf/broker.conf` file to enable TLS encryption on WebSocket service. For more details, see [security settings for WebSocket](client-libraries-websocket.md/#security-settings).
+
 </TabItem>
 </Tabs>
 ````