You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/06/10 09:02:54 UTC
[pulsar] branch asf-site updated: Updated site at revision 245e8d9
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 39b797b Updated site at revision 245e8d9
39b797b is described below
commit 39b797be696437c372fe16434b7750e1e2fd7a93
Author: jenkins <bu...@apache.org>
AuthorDate: Mon Jun 10 09:02:45 2019 +0000
Updated site at revision 245e8d9
---
.../zh-CN/2.1.0-incubating/adaptors-kafka.html | 6 +-
.../2.1.0-incubating/adaptors-kafka/index.html | 6 +-
.../2.1.0-incubating/client-libraries-python.html | 46 +++----
.../client-libraries-python/index.html | 46 +++----
.../client-libraries-websocket.html | 32 ++---
.../client-libraries-websocket/index.html | 32 ++---
.../cookbooks-retention-expiry.html | 2 +-
.../cookbooks-retention-expiry/index.html | 2 +-
.../zh-CN/2.1.1-incubating/adaptors-kafka.html | 6 +-
.../2.1.1-incubating/adaptors-kafka/index.html | 6 +-
.../2.1.1-incubating/client-libraries-python.html | 46 +++----
.../client-libraries-python/index.html | 46 +++----
.../client-libraries-websocket.html | 32 ++---
.../client-libraries-websocket/index.html | 32 ++---
.../cookbooks-retention-expiry.html | 2 +-
.../cookbooks-retention-expiry/index.html | 2 +-
content/docs/zh-CN/2.2.0/adaptors-kafka.html | 6 +-
content/docs/zh-CN/2.2.0/adaptors-kafka/index.html | 6 +-
.../docs/zh-CN/2.2.0/client-libraries-python.html | 46 +++----
.../zh-CN/2.2.0/client-libraries-python/index.html | 46 +++----
.../zh-CN/2.2.0/client-libraries-websocket.html | 32 ++---
.../2.2.0/client-libraries-websocket/index.html | 32 ++---
.../zh-CN/2.2.0/cookbooks-retention-expiry.html | 2 +-
.../2.2.0/cookbooks-retention-expiry/index.html | 2 +-
content/docs/zh-CN/2.2.1/adaptors-kafka.html | 6 +-
content/docs/zh-CN/2.2.1/adaptors-kafka/index.html | 6 +-
.../docs/zh-CN/2.2.1/client-libraries-python.html | 46 +++----
.../zh-CN/2.2.1/client-libraries-python/index.html | 46 +++----
.../zh-CN/2.2.1/client-libraries-websocket.html | 47 +++----
.../2.2.1/client-libraries-websocket/index.html | 47 +++----
.../zh-CN/2.2.1/cookbooks-retention-expiry.html | 2 +-
.../2.2.1/cookbooks-retention-expiry/index.html | 2 +-
content/docs/zh-CN/2.3.0/adaptors-kafka.html | 6 +-
content/docs/zh-CN/2.3.0/adaptors-kafka/index.html | 6 +-
.../docs/zh-CN/2.3.0/client-libraries-python.html | 115 +++++++++--------
.../zh-CN/2.3.0/client-libraries-python/index.html | 115 +++++++++--------
.../zh-CN/2.3.0/client-libraries-websocket.html | 47 +++----
.../2.3.0/client-libraries-websocket/index.html | 47 +++----
.../zh-CN/2.3.0/cookbooks-retention-expiry.html | 2 +-
.../2.3.0/cookbooks-retention-expiry/index.html | 2 +-
content/docs/zh-CN/2.3.1/adaptors-kafka.html | 6 +-
content/docs/zh-CN/2.3.1/adaptors-kafka/index.html | 6 +-
.../docs/zh-CN/2.3.1/client-libraries-python.html | 123 +++++++++---------
.../zh-CN/2.3.1/client-libraries-python/index.html | 123 +++++++++---------
.../zh-CN/2.3.1/client-libraries-websocket.html | 47 +++----
.../2.3.1/client-libraries-websocket/index.html | 47 +++----
.../zh-CN/2.3.1/cookbooks-retention-expiry.html | 2 +-
.../2.3.1/cookbooks-retention-expiry/index.html | 2 +-
content/docs/zh-CN/adaptors-kafka.html | 6 +-
content/docs/zh-CN/adaptors-kafka/index.html | 6 +-
content/docs/zh-CN/client-libraries-python.html | 123 +++++++++---------
.../docs/zh-CN/client-libraries-python/index.html | 123 +++++++++---------
content/docs/zh-CN/client-libraries-websocket.html | 47 +++----
.../zh-CN/client-libraries-websocket/index.html | 47 +++----
content/docs/zh-CN/cookbooks-retention-expiry.html | 2 +-
.../zh-CN/cookbooks-retention-expiry/index.html | 2 +-
content/docs/zh-CN/next/adaptors-kafka.html | 6 +-
content/docs/zh-CN/next/adaptors-kafka/index.html | 6 +-
.../docs/zh-CN/next/client-libraries-python.html | 139 ++++++++++-----------
.../zh-CN/next/client-libraries-python/index.html | 139 ++++++++++-----------
.../zh-CN/next/client-libraries-websocket.html | 49 ++++----
.../next/client-libraries-websocket/index.html | 49 ++++----
.../zh-CN/next/cookbooks-retention-expiry.html | 2 +-
.../next/cookbooks-retention-expiry/index.html | 2 +-
content/swagger/2.4.0-SNAPSHOT/swagger.json | 38 +++---
.../swagger/2.4.0-SNAPSHOT/swaggerfunctions.json | 36 +++---
66 files changed, 1119 insertions(+), 1117 deletions(-)
diff --git a/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka.html b/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka.html
index c8af6bd..2417596 100644
--- a/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka.html
+++ b/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -310,7 +310,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka/index.html b/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka/index.html
index c8af6bd..2417596 100644
--- a/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/2.1.0-incubating/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -310,7 +310,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.0-incubating/client-libraries-python.html b/content/docs/zh-CN/2.1.0-incubating/client-libraries-python.html
index e5f3a05..f10a61e 100644
--- a/content/docs/zh-CN/2.1.0-incubating/client-libraries-python.html
+++ b/content/docs/zh-CN/2.1.0-incubating/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ client library</a> and exposes [...]
-"/><meta name="docsearch:version" content="2.1.0-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C+ [...]
+"/><meta name="docsearch:version" content="2.1.0-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href=&q [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,36 +76,36 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS 10.12 (Sierra) and 10.13 (High Sierra)</td><td style="text-align:left">2.7, 3.6</td></tr>
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -117,8 +117,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -128,9 +128,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.1.0-incubating/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.1.0-incubating/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -138,9 +138,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Install [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.0-incubating/client-libraries-python/index.html b/content/docs/zh-CN/2.1.0-incubating/client-libraries-python/index.html
index e5f3a05..f10a61e 100644
--- a/content/docs/zh-CN/2.1.0-incubating/client-libraries-python/index.html
+++ b/content/docs/zh-CN/2.1.0-incubating/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ client library</a> and exposes [...]
-"/><meta name="docsearch:version" content="2.1.0-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C+ [...]
+"/><meta name="docsearch:version" content="2.1.0-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href=&q [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,36 +76,36 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS 10.12 (Sierra) and 10.13 (High Sierra)</td><td style="text-align:left">2.7, 3.6</td></tr>
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -117,8 +117,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -128,9 +128,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.1.0-incubating/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.1.0-incubating/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -138,9 +138,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Install [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket.html b/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket.html
index d6cfb72..e5c1f20 100644
--- a/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket.html
+++ b/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket.html
@@ -78,17 +78,17 @@
});
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.0-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.0-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.1.0-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.1.0-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.1.0-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.1.0-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">Subscription type</a>: <code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -212,7 +212,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -264,7 +264,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -285,7 +285,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -303,9 +303,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -431,7 +431,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入puls [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pul [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket/index.html b/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket/index.html
index d6cfb72..e5c1f20 100644
--- a/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/2.1.0-incubating/client-libraries-websocket/index.html
@@ -78,17 +78,17 @@
});
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.0-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.0-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.0-incubating/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.1.0-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.1.0-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.1.0-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.1.0-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">Subscription type</a>: <code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -212,7 +212,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -264,7 +264,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -285,7 +285,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -303,9 +303,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -431,7 +431,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入puls [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.0-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.0-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pul [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry.html b/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry.html
index c022351..e0eedfc 100644
--- a/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.1.0-incubating/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry/index.html
index c022351..e0eedfc 100644
--- a/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/2.1.0-incubating/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.1.0-incubating/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka.html b/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka.html
index 253a684..621a274 100644
--- a/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka.html
+++ b/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -310,7 +310,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka/index.html b/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka/index.html
index 253a684..621a274 100644
--- a/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/2.1.1-incubating/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -310,7 +310,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.1-incubating/client-libraries-python.html b/content/docs/zh-CN/2.1.1-incubating/client-libraries-python.html
index c9e4222..b281dfb 100644
--- a/content/docs/zh-CN/2.1.1-incubating/client-libraries-python.html
+++ b/content/docs/zh-CN/2.1.1-incubating/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ client library</a> and exposes [...]
-"/><meta name="docsearch:version" content="2.1.1-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C+ [...]
+"/><meta name="docsearch:version" content="2.1.1-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href=&q [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,17 +76,17 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
@@ -94,19 +94,19 @@
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6, 3.7</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -118,8 +118,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -129,9 +129,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.1.1-incubating/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.1.1-incubating/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -139,9 +139,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Install [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.1-incubating/client-libraries-python/index.html b/content/docs/zh-CN/2.1.1-incubating/client-libraries-python/index.html
index c9e4222..b281dfb 100644
--- a/content/docs/zh-CN/2.1.1-incubating/client-libraries-python/index.html
+++ b/content/docs/zh-CN/2.1.1-incubating/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ client library</a> and exposes [...]
-"/><meta name="docsearch:version" content="2.1.1-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C+ [...]
+"/><meta name="docsearch:version" content="2.1.1-incubating"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href=&q [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,17 +76,17 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
@@ -94,19 +94,19 @@
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6, 3.7</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -118,8 +118,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -129,9 +129,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.1.1-incubating/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.1.1-incubating/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -139,9 +139,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Install [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket.html b/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket.html
index aab8ae0..f5b2d48 100644
--- a/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket.html
+++ b/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket.html
@@ -78,17 +78,17 @@
});
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.1-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.1-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.1.1-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.1.1-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.1.1-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.1.1-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">Subscription type</a>: <code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -212,7 +212,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -264,7 +264,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -285,7 +285,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -303,9 +303,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -431,7 +431,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入puls [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pul [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket/index.html b/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket/index.html
index aab8ae0..f5b2d48 100644
--- a/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/2.1.1-incubating/client-libraries-websocket/index.html
@@ -78,17 +78,17 @@
});
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.1-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.1.1-incubating/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.1.1-incubating/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.1.1-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.1.1-incubating/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.1.1-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.1.1-incubating/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.incubator.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">Subscription type</a>: <code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -212,7 +212,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -264,7 +264,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -285,7 +285,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -303,9 +303,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -431,7 +431,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入puls [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.1.1-incubating/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.1.1-incubating/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pul [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry.html b/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry.html
index 03698d0..f18210e 100644
--- a/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.1.1-incubating/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry/index.html
index 03698d0..f18210e 100644
--- a/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/2.1.1-incubating/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.1.1-incubating/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.2.0/adaptors-kafka.html b/content/docs/zh-CN/2.2.0/adaptors-kafka.html
index f4b7199..ff089d1 100644
--- a/content/docs/zh-CN/2.2.0/adaptors-kafka.html
+++ b/content/docs/zh-CN/2.2.0/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -312,7 +312,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.0/adaptors-kafka/index.html b/content/docs/zh-CN/2.2.0/adaptors-kafka/index.html
index f4b7199..ff089d1 100644
--- a/content/docs/zh-CN/2.2.0/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/2.2.0/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -312,7 +312,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.0/client-libraries-python.html b/content/docs/zh-CN/2.2.0/client-libraries-python.html
index e48169d..5708e39 100644
--- a/content/docs/zh-CN/2.2.0/client-libraries-python.html
+++ b/content/docs/zh-CN/2.2.0/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.2.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.2.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,17 +76,17 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
@@ -94,19 +94,19 @@
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6, 3.7</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.2.0/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.2.0/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -118,8 +118,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -129,9 +129,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.2.0/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.2.0/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -139,9 +139,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.0/client-libraries-python/index.html b/content/docs/zh-CN/2.2.0/client-libraries-python/index.html
index e48169d..5708e39 100644
--- a/content/docs/zh-CN/2.2.0/client-libraries-python/index.html
+++ b/content/docs/zh-CN/2.2.0/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.2.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.2.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,17 +76,17 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
@@ -94,19 +94,19 @@
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6, 3.7</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.2.0/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.2.0/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -118,8 +118,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -129,9 +129,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.2.0/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.2.0/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -139,9 +139,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.0/client-libraries-websocket.html b/content/docs/zh-CN/2.2.0/client-libraries-websocket.html
index 6b32d74..c28191b 100644
--- a/content/docs/zh-CN/2.2.0/client-libraries-websocket.html
+++ b/content/docs/zh-CN/2.2.0/client-libraries-websocket.html
@@ -78,17 +78,17 @@
});
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.0/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.0/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.2.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.2.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.2.0/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.2.0/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -212,7 +212,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -264,7 +264,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -285,7 +285,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -303,9 +303,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -431,7 +431,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.0/client-libraries-websocket/index.html b/content/docs/zh-CN/2.2.0/client-libraries-websocket/index.html
index 6b32d74..c28191b 100644
--- a/content/docs/zh-CN/2.2.0/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/2.2.0/client-libraries-websocket/index.html
@@ -78,17 +78,17 @@
});
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.0/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.0/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.2.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.2.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.2.0/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.2.0/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -212,7 +212,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -264,7 +264,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -285,7 +285,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -303,9 +303,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -431,7 +431,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry.html b/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry.html
index 7e1af3c..d04769f 100644
--- a/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.2.0/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry/index.html
index 7e1af3c..d04769f 100644
--- a/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/2.2.0/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.2.0/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.2.1/adaptors-kafka.html b/content/docs/zh-CN/2.2.1/adaptors-kafka.html
index 5370387..db7e17a 100644
--- a/content/docs/zh-CN/2.2.1/adaptors-kafka.html
+++ b/content/docs/zh-CN/2.2.1/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -312,7 +312,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.1/adaptors-kafka/index.html b/content/docs/zh-CN/2.2.1/adaptors-kafka/index.html
index 5370387..db7e17a 100644
--- a/content/docs/zh-CN/2.2.1/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/2.2.1/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -312,7 +312,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setMaxTotalReceiverQueueSizeAcrossPartitions-int-"><code>pulsar.consumer.total.receiver.queue.size.across.partitions</code></a></td><td style="text-align:left">50000</td><td style="text-align:left">Set the max total receiver queue size across partitons</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.1/client-libraries-python.html b/content/docs/zh-CN/2.2.1/client-libraries-python.html
index 3517cda..9382e20 100644
--- a/content/docs/zh-CN/2.2.1/client-libraries-python.html
+++ b/content/docs/zh-CN/2.2.1/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,17 +76,17 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
@@ -94,19 +94,19 @@
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6, 3.7</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.2.1/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.2.1/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -118,8 +118,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -129,9 +129,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.2.1/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.2.1/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -139,9 +139,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.1/client-libraries-python/index.html b/content/docs/zh-CN/2.2.1/client-libraries-python/index.html
index 3517cda..9382e20 100644
--- a/content/docs/zh-CN/2.2.1/client-libraries-python/index.html
+++ b/content/docs/zh-CN/2.2.1/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,17 +76,17 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.2.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
@@ -94,19 +94,19 @@
<tr><td style="text-align:left">Linux</td><td style="text-align:left">2.7, 3.3, 3.4, 3.5, 3.6, 3.7</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.2.1/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.2.1/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -118,8 +118,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -129,9 +129,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.2.1/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/2.2.1/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -139,9 +139,9 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.1/client-libraries-websocket.html b/content/docs/zh-CN/2.2.1/client-libraries-websocket.html
index 85a5bf9..ea5b8e3 100644
--- a/content/docs/zh-CN/2.2.1/client-libraries-websocket.html
+++ b/content/docs/zh-CN/2.2.1/client-libraries-websocket.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.1/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.1/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.2.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.2.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.2.1/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.2.1/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.1/client-libraries-websocket/index.html b/content/docs/zh-CN/2.2.1/client-libraries-websocket/index.html
index 85a5bf9..ea5b8e3 100644
--- a/content/docs/zh-CN/2.2.1/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/2.2.1/client-libraries-websocket/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.2.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.2.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.1/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.2.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.2.1/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.2.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.2.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.2.1/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.2.1/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.2.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.2.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry.html b/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry.html
index 26af2fc..986519b 100644
--- a/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.2.1/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry/index.html
index 26af2fc..986519b 100644
--- a/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/2.2.1/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.2.1/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.3.0/adaptors-kafka.html b/content/docs/zh-CN/2.3.0/adaptors-kafka.html
index d00560f..2339ea6 100644
--- a/content/docs/zh-CN/2.3.0/adaptors-kafka.html
+++ b/content/docs/zh-CN/2.3.0/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -315,7 +315,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.0/adaptors-kafka/index.html b/content/docs/zh-CN/2.3.0/adaptors-kafka/index.html
index d00560f..2339ea6 100644
--- a/content/docs/zh-CN/2.3.0/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/2.3.0/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,你需要使用<code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code>而不是<code>org.apache.kafka.clients.producer.KafkaProducer</code>构造producer,使用<code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code>构造consumer</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -315,7 +315,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用pulsar-kafka兼容包装器和现存的kafka客户 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.0/client-libraries-python.html b/content/docs/zh-CN/2.3.0/client-libraries-python.html
index 99513db..373cad0 100644
--- a/content/docs/zh-CN/2.3.0/client-libraries-python.html
+++ b/content/docs/zh-CN/2.3.0/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.3.0/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.3.0/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,8 +119,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -130,9 +130,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.3.0/concepts-clients#reader-interface">reader interface</a>. 下面是一个示例:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -140,10 +140,10 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. 例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
@@ -152,17 +152,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -174,7 +174,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
consumer.acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
<table>
<thead>
@@ -187,12 +187,12 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -202,43 +202,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -248,7 +247,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.0/client-libraries-python/index.html b/content/docs/zh-CN/2.3.0/client-libraries-python/index.html
index 99513db..373cad0 100644
--- a/content/docs/zh-CN/2.3.0/client-libraries-python/index.html
+++ b/content/docs/zh-CN/2.3.0/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.0/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.3.0/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.3.0/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,8 +119,8 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
@@ -130,9 +130,9 @@ client.close()
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.3.0/concepts-clients#reader-interface">reader interface</a>. 下面是一个示例:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -140,10 +140,10 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. 例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
@@ -152,17 +152,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -174,7 +174,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
consumer.acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
<table>
<thead>
@@ -187,12 +187,12 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -202,43 +202,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -248,7 +247,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.0/client-libraries-websocket.html b/content/docs/zh-CN/2.3.0/client-libraries-websocket.html
index e3dfea3..af1381b 100644
--- a/content/docs/zh-CN/2.3.0/client-libraries-websocket.html
+++ b/content/docs/zh-CN/2.3.0/client-libraries-websocket.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.0/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.0/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.3.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.3.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.3.0/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.3.0/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.0/client-libraries-websocket/index.html b/content/docs/zh-CN/2.3.0/client-libraries-websocket/index.html
index e3dfea3..af1381b 100644
--- a/content/docs/zh-CN/2.3.0/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/2.3.0/client-libraries-websocket/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.3.0"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.0/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.0/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.0/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.0/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.3.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.3.0/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.3.0/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.3.0/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.0/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.0/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry.html b/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry.html
index 66a0e28..d8204b7 100644
--- a/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.3.0/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry/index.html
index 66a0e28..d8204b7 100644
--- a/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/2.3.0/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.3.0/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.3.1/adaptors-kafka.html b/content/docs/zh-CN/2.3.1/adaptors-kafka.html
index 82e5476..e134eda 100644
--- a/content/docs/zh-CN/2.3.1/adaptors-kafka.html
+++ b/content/docs/zh-CN/2.3.1/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code> 而不是 <code>org.apache.kafka.clients.producer.KafkaProducer</code> 构造生产者,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code> 构造消费者。</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -316,7 +316,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers.</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.1/adaptors-kafka/index.html b/content/docs/zh-CN/2.3.1/adaptors-kafka/index.html
index 82e5476..e134eda 100644
--- a/content/docs/zh-CN/2.3.1/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/2.3.1/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code> 而不是 <code>org.apache.kafka.clients.producer.KafkaProducer</code> 构造生产者,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code> 构造消费者。</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -316,7 +316,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers.</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.1/client-libraries-python.html b/content/docs/zh-CN/2.3.1/client-libraries-python.html
index 3e2bb09..0517ec3 100644
--- a/content/docs/zh-CN/2.3.1/client-libraries-python.html
+++ b/content/docs/zh-CN/2.3.1/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.3.1/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.3.1/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,25 +119,25 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.3.1/concepts-clients#reader-interface">reader interface</a>. 下面是一个示例:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -145,10 +145,10 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. 例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
@@ -157,17 +157,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -178,13 +178,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
ex = msg.value()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># # 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
<table>
<thead>
@@ -197,12 +197,12 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -212,43 +212,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -258,7 +257,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.1/client-libraries-python/index.html b/content/docs/zh-CN/2.3.1/client-libraries-python/index.html
index 3e2bb09..0517ec3 100644
--- a/content/docs/zh-CN/2.3.1/client-libraries-python/index.html
+++ b/content/docs/zh-CN/2.3.1/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ client library& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可 [...]
+"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp"> [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ client libr [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/2.3.1/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/2.3.1/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/2.3.1/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,25 +119,25 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/2.3.1/concepts-clients#reader-interface">reader interface</a>. 下面是一个示例:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -145,10 +145,10 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. 例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
@@ -157,17 +157,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -178,13 +178,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
ex = msg.value()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># # 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
<table>
<thead>
@@ -197,12 +197,12 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -212,43 +212,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -258,7 +257,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></l [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.1/client-libraries-websocket.html b/content/docs/zh-CN/2.3.1/client-libraries-websocket.html
index b6a89de..c01f1d1 100644
--- a/content/docs/zh-CN/2.3.1/client-libraries-websocket.html
+++ b/content/docs/zh-CN/2.3.1/client-libraries-websocket.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.1/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.1/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.3.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.3.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.3.1/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.3.1/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.1/client-libraries-websocket/index.html b/content/docs/zh-CN/2.3.1/client-libraries-websocket/index.html
index b6a89de..c01f1d1 100644
--- a/content/docs/zh-CN/2.3.1/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/2.3.1/client-libraries-websocket/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.3.1"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/2.3.1/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.1/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/2.3.1/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/2.3.1/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/2.3.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/2.3.1/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/2.3.1/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/2.3.1/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Br [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/2.3.1/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/2.3.1/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry.html b/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry.html
index a0411ee..dc77a81 100644
--- a/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.3.1/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry/index.html
index a0411ee..dc77a81 100644
--- a/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/2.3.1/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/2.3.1/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/adaptors-kafka.html b/content/docs/zh-CN/adaptors-kafka.html
index 1cd87d9..4b4363a 100644
--- a/content/docs/zh-CN/adaptors-kafka.html
+++ b/content/docs/zh-CN/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code> 而不是 <code>org.apache.kafka.clients.producer.KafkaProducer</code> 构造生产者,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code> 构造消费者。</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -316,7 +316,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers.</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客户端">使用 Pul [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客户端">使用 Pul [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/adaptors-kafka/index.html b/content/docs/zh-CN/adaptors-kafka/index.html
index 1cd87d9..4b4363a 100644
--- a/content/docs/zh-CN/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code> 而不是 <code>org.apache.kafka.clients.producer.KafkaProducer</code> 构造生产者,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code> 构造消费者。</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -316,7 +316,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers.</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客户端">使用 Pul [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客户端">使用 Pul [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/client-libraries-python.html b/content/docs/zh-CN/client-libraries-python.html
index 7375e68..98173cd 100644
--- a/content/docs/zh-CN/client-libraries-python.html
+++ b/content/docs/zh-CN/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/client-libraries-cpp">C++ client library</a> and exposes all of the <a [...]
-"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/client-libraries-cpp">C++ client library</a& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可以在 < [...]
+"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功 [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/client-libraries-cpp">C++ client library</a [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,25 +119,25 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/concepts-clients#reader-interface">reader interface</a>. 下面是一个示例:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -145,10 +145,10 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. 例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
@@ -157,17 +157,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -178,13 +178,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
ex = msg.value()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># # 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
<table>
<thead>
@@ -197,12 +197,12 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -212,43 +212,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -258,7 +257,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></li><li><a hre [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码安装</a></li>< [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/client-libraries-python/index.html b/content/docs/zh-CN/client-libraries-python/index.html
index 7375e68..98173cd 100644
--- a/content/docs/zh-CN/client-libraries-python/index.html
+++ b/content/docs/zh-CN/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/client-libraries-cpp">C++ client library</a> and exposes all of the <a [...]
-"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/client-libraries-cpp">C++ client library</a& [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可以在 < [...]
+"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功 [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/client-libraries-cpp">C++ client library</a [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,25 +119,25 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/concepts-clients#reader-interface">reader interface</a>. 下面是一个示例:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -145,10 +145,10 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. 例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
@@ -157,17 +157,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -178,13 +178,13 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
ex = msg.value()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># # 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
<table>
<thead>
@@ -197,12 +197,12 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -212,43 +212,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -258,7 +257,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></li><li><a hre [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码安装</a></li>< [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/client-libraries-websocket.html b/content/docs/zh-CN/client-libraries-websocket.html
index 19f86f5..4bd412f 100644
--- a/content/docs/zh-CN/client-libraries-websocket.html
+++ b/content/docs/zh-CN/client-libraries-websocket.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Broker</a></li [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar Broker</a></ [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/client-libraries-websocket/index.html b/content/docs/zh-CN/client-libraries-websocket/index.html
index 19f86f5..4bd412f 100644
--- a/content/docs/zh-CN/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/client-libraries-websocket/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
-"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar's WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/ [...]
+"/><meta name="docsearch:version" content="2.3.2"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar's WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar's WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行 [...]
<blockquote>
<p>You can use Pulsar's WebSocket API with any WebSocket client library. See examples for Python and Node.js <a href="#client-examples">below</a>.</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">Enable pull mode (default: false). See "Flow Control" below.</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -291,7 +292,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -312,7 +313,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -330,9 +331,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -458,7 +459,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Broker</a></li [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar Broker</a></ [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/cookbooks-retention-expiry.html b/content/docs/zh-CN/cookbooks-retention-expiry.html
index 8154e37..b2fe1e2 100644
--- a/content/docs/zh-CN/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/cookbooks-retention-expiry/index.html
index 8154e37..b2fe1e2 100644
--- a/content/docs/zh-CN/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/next/adaptors-kafka.html b/content/docs/zh-CN/next/adaptors-kafka.html
index 6225efc..194744e 100644
--- a/content/docs/zh-CN/next/adaptors-kafka.html
+++ b/content/docs/zh-CN/next/adaptors-kafka.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code> 而不是 <code>org.apache.kafka.clients.producer.KafkaProducer</code> 构造生产者,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code> 构造消费者。</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -316,7 +316,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers.</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/next/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/next/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/next/adaptors-kafka/index.html b/content/docs/zh-CN/next/adaptors-kafka/index.html
index 6225efc..194744e 100644
--- a/content/docs/zh-CN/next/adaptors-kafka/index.html
+++ b/content/docs/zh-CN/next/adaptors-kafka/index.html
@@ -102,7 +102,7 @@
<span class="hljs-tag"></<span class="hljs-name">dependency</span>></span>
</code></pre>
<p>当使用这个依赖时,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaProducer</code> 而不是 <code>org.apache.kafka.clients.producer.KafkaProducer</code> 构造生产者,应使用 <code>org.apache.kafka.clients.producer.PulsarKafkaConsumer</code> 构造消费者。</p>
-<h2><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java"><span class="hljs-comment">// 主题应为常规 Pulsar 主题</span>
String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
@@ -122,7 +122,7 @@ Producer<Integer, String> producer = <span class="hljs-keyword">new</span>
producer.close();
</code></pre>
-<h2><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<h2><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<pre><code class="hljs css language-java">String topic = <span class="hljs-string">"persistent://public/default/my-topic"</span>;
Properties props = <span class="hljs-keyword">new</span> Properties();
@@ -316,7 +316,7 @@ consumer.subscribe(Arrays.asList(topic));
<tr><td style="text-align:left"><a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#subscriptionTopicsMode-Mode-"><code>pulsar.consumer.subscription.topics.mode</code></a></td><td style="text-align:left">PersistentOnly</td><td style="text-align:left">Set the subscription topic mode for consumers.</td></tr>
</tbody>
</table>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/next/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客 [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/admin-api-schemas"><span class="arrow-prev">← </span><span>Schema</span></a><a class="docs-next button" href="/docs/zh-CN/next/adaptors-spark"><span>Apache Spark</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#使用-pulsar-kafka-兼容包装器">使用 Pulsar Kafka 兼容包装器</a></li><li><a href="#使用-pulsar-kafka-兼容包装器和现有-kafka-客 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/next/client-libraries-python.html b/content/docs/zh-CN/next/client-libraries-python.html
index 0968fbe..01e0c0b 100644
--- a/content/docs/zh-CN/next/client-libraries-python.html
+++ b/content/docs/zh-CN/next/client-libraries-python.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/next/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/next/client-libraries-cpp">C++ client library< [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar Python客户端 · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/next/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可以在 <a [...]
+"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar Python客户端 · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/next/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能< [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/next/client-libraries-cpp">C++ client libra [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar Python客户端</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/next/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可以 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/next/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/next/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,25 +119,25 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/next/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/next/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -145,11 +145,11 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
-<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. For example:</p>
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>可以通过继承 <code>pulsar.schema.Record</code> 定义 schema,并将字段定义为 类变量。例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
@@ -157,17 +157,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -178,31 +178,31 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
ex = msg.value()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># # 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>Pulsar 中可以使用的不同的内置 schema 类型。所有定义都在 <code>pulsar.schema</code> 包中。</p>
<table>
<thead>
<tr><th>Schema</th><th>备注</th></tr>
</thead>
<tbody>
-<tr><td><code>BytesSchema</code></td><td>Get the raw payload as a <code>bytes</code> object. No serialization/deserialization are performed. This is the default schema mode</td></tr>
-<tr><td><code>StringSchema</code></td><td>Encode/decode payload as a UTF-8 string. Uses <code>str</code> objects</td></tr>
-<tr><td><code>JsonSchema</code></td><td>Require record definition. Serializes the record into standard JSON payload</td></tr>
-<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
+<tr><td><code>BytesSchema</code></td><td>默认 schema 模式,获取原始 payload 为 <code>bytes</code> 对象,不进行序列化或者反序列化。</td></tr>
+<tr><td><code>StringSchema</code></td><td>编码和解码的 payload 为 UTF-8 字符集。使用 <code>str</code> 对象</td></tr>
+<tr><td><code>JsonSchema</code></td><td>需要记录定义。将记录序列化为标准的 JSON payload</td></tr>
+<tr><td><code>AvroSchema</code></td><td>需要记录定义。序列化为 AVRO 格式。</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -212,43 +212,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
-<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
+<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key 总是 <code>String</code>类型,需要指定 value 的类型。</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -258,7 +257,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/next/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></li> [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/next/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码安装 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/next/client-libraries-python/index.html b/content/docs/zh-CN/next/client-libraries-python/index.html
index 0968fbe..01e0c0b 100644
--- a/content/docs/zh-CN/next/client-libraries-python/index.html
+++ b/content/docs/zh-CN/next/client-libraries-python/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>The Pulsar Python client · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/next/client-libraries-cpp">C++ client library</a> and exposes all of the [...]
-"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="The Pulsar Python client · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/next/client-libraries-cpp">C++ client library< [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar Python客户端 · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/next/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可以在 <a [...]
+"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar Python客户端 · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/next/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能< [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,38 +76,38 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">The Pulsar Python client</h1></header><article><div><span><p>The Pulsar Python client library is a wrapper over the existing <a href="/docs/zh-CN/next/client-libraries-cpp">C++ client libra [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar Python客户端</h1></header><article><div><span><p>Pulsar 的 Python 客户端库是对现有 <a href="/docs/zh-CN/next/client-libraries-cpp">C++ 客户端库</a>的封装, <a href="/api/cpp">它所包含的功能</a>与 C++ 客户端相同。 你可以 [...]
<h2><a class="anchor" aria-hidden="true" id="安装"></a><a href="#安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
-<p>You can install the <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a> library either via <a href="https://pypi.python.org/pypi">PyPi</a>, using <a href="#installation-using-pip">pip</a>, or by building the library from source.</p>
-<h3><a class="anchor" aria-hidden="true" id="installation-using-pip"></a><a href="#installation-using-pip" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library as a pre-built package using the <a href="https://pip.pypa.io/en/stable/">pip</a> package manager:</p>
+<p>你可以通过 <a href="https://pypi.python.org/pypi">PyPi</a>,用 <a href="#installation-using-pip">pip</a> 的方式或者通过源代码来安装 <a href="https://pypi.python.org/pypi/pulsar-client"><code>pulsar-client</code></a>。</p>
+<h3><a class="anchor" aria-hidden="true" id="使用pip安装"></a><a href="#使用pip安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>使用包管理工具 pip 安装已经打包好的 <code>pulsar-client</code>:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pip install pulsar-client==2.3.2</span>
</code></pre>
-<p>Installation via PyPi is available for the following Python versions:</p>
+<p>以下 Python 版本支持通过 PyPi 的方式进行安装:</p>
<table>
<thead>
-<tr><th style="text-align:left">Platform</th><th style="text-align:left">Supported Python versions</th></tr>
+<tr><th style="text-align:left">平台</th><th style="text-align:left">支持的 Python 版本</th></tr>
</thead>
<tbody>
<tr><td style="text-align:left">MacOS</td></tr>
</tbody>
</table>
<p>10.11 (El Capitan) — 10.12 (Sierra) —<br>
-10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
-| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
-<h3><a class="anchor" aria-hidden="true" id="installing-from-source"></a><a href="#installing-from-source" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>To install the <code>pulsar-client</code> library by building from source, follow <a href="/docs/zh-CN/next/client-libraries-cpp#compilation">these instructions</a> and compile the Pulsar C++ client library. That will also build the Python binding for the library.</p>
-<p>To install the built Python bindings:</p>
+10.13 (High Sierra) — 10.14 (Mojave) | 2.7, 3.7 |
+| Linux | 2.7, 3.4, 3.5, 3.6, 3.7 |</p>
+<h3><a class="anchor" aria-hidden="true" id="通过源代码安装"></a><a href="#通过源代码安装" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<p>通过源码安装 <code>pulsar-client</code>,请参照<a href="/docs/zh-CN/next/client-libraries-cpp#compilation">安装步骤</a>中的示例进行操作并编译 Pulsar C++ 客户端库。 这也构建 Python 包到拓展库中。</p>
+<p>安装已经构建好的 Python 包:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> git <span class="hljs-built_in">clone</span> https://github.com/apache/pulsar</span>
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">cd</span> pulsar/pulsar-client-cpp/python</span>
<span class="hljs-meta">$</span><span class="bash"> sudo python setup.py install</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<p>The complete Python API reference is available at <a href="/api/python">api/python</a>.</p>
-<h2><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
-<p>Below you'll find a variety of Python code examples for the <code>pulsar-client</code> library.</p>
-<h3><a class="anchor" aria-hidden="true" id="producer-example"></a><a href="#producer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a Python producer for the <code>my-topic</code> topic and send 10 messages on that topic:</p>
+<p>在 <a href="/api/python">api/python</a> 上有完整的 Python API 手册。</p>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>下面是 <code>pulsar-client</code> 库的各种 Python 代码示例。</p>
+<h3><a class="anchor" aria-hidden="true" id="生产者示例"></a><a href="#生产者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个 Python 生产者,主题为 <code>my-topic</code>,并向这个主题发送了10条消息。</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">import</span> pulsar
client = pulsar.Client(<span class="hljs-string">'pulsar://localhost:6650'</span>)
@@ -119,25 +119,25 @@ producer = client.create_producer(<span class="hljs-string">'my-topic'</span>)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="consumer-example"></a><a href="#consumer-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
-<p>This creates a consumer with the <code>my-subscription</code> subscription on the <code>my-topic</code> topic, listen for incoming messages, print the content and ID of messages that arrive, and acknowledge each message to the Pulsar broker:</p>
+<h3><a class="anchor" aria-hidden="true" id="消费者示例"></a><a href="#消费者示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p>创建一个消费者,使用 <code>my-subscription</code> 订阅主题 <code>my-topic</code> ,监听传入的消息,打印内容和到达消息的ID,并且向 Pulsar broker 确认每条消息:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(<span class="hljs-string">'my-topic'</span>, <span class="hljs-string">'my-subscription'</span>)
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = consumer.receive()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
client.close()
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="reader-interface-example"></a><a href="#reader-interface-example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-. [...]
-<p>You can use the Pulsar Python API to use the Pulsar <a href="/docs/zh-CN/next/concepts-clients#reader-interface">reader interface</a>. Here's an example:</p>
-<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId taken from a previously fetched message</span>
+<h3><a class="anchor" aria-hidden="true" id="读者接口示例"></a><a href="#读者接口示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
+<p>你可以使用 Pulsar Python API 调用 Pulsar <a href="/docs/zh-CN/next/concepts-clients#reader-interface">reader 接口</a>。示例如下:</p>
+<pre><code class="hljs css language-python"><span class="hljs-comment"># MessageId 取自先前获取的消息</span>
msg_id = msg.message_id()
reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_id)
@@ -145,11 +145,11 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
<span class="hljs-keyword">while</span> <span class="hljs-literal">True</span>:
msg = reader.receive()
print(<span class="hljs-string">"Received message '{}' id='{}'"</span>.format(msg.data(), msg.message_id()))
- <span class="hljs-comment"># No acknowledgment</span>
+ <span class="hljs-comment"># 无确认操作</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="schema"></a><a href="#schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
-<h3><a class="anchor" aria-hidden="true" id="declaring-and-validating-schema"></a><a href="#declaring-and-validating-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 [...]
-<p>A schema can be declared by passing a class that inherits from <code>pulsar.schema.Record</code> and defines the fields as class variables. For example:</p>
+<h3><a class="anchor" aria-hidden="true" id="声明和验证-schema"></a><a href="#声明和验证-schema" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
+<p>可以通过继承 <code>pulsar.schema.Record</code> 定义 schema,并将字段定义为 类变量。例如:</p>
<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> pulsar.schema <span class="hljs-keyword">import</span> *
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
@@ -157,17 +157,17 @@ reader = client.create_reader(<span class="hljs-string">'my-topic'</span>, msg_i
b = Integer()
c = Boolean()
</code></pre>
-<p>With this simple schema definition we can then create producers, consumers and readers instances that will be referring to that.</p>
+<p>用这种简单的 schema 定义方式,我们可以创建生产者,消费者和读者实例。</p>
<pre><code class="hljs css language-python">producer = client.create_producer(
topic=<span class="hljs-string">'my-topic'</span>,
schema=AvroSchema(Example) )
producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class="hljs-number">1</span>))
</code></pre>
-<p>When the producer is created, the Pulsar broker will validate that the existing topic schema is indeed of "Avro" type and that the format is compatible with the schema definition of the <code>Example</code> class.</p>
-<p>If there is a mismatch, the producer creation will raise an exception.</p>
-<p>Once a producer is created with a certain schema definition, it will only accept objects that are instances of the declared schema class.</p>
-<p>Similarly, for a consumer/reader, the consumer will return an object, instance of the schema record class, rather than the raw bytes:</p>
+<p>当生产者创建时,Pulsar broker 会验证现有的 topic schema 是否是“ Avro ”类型,并且格式与 <code>Example</code> 类的 schema 定义兼容。</p>
+<p>如果出现不匹配,生产者创建将会抛出异常。</p>
+<p>一旦一个生产者创建了一个 schema 定义,它只接受声明的 schema 类别的实例。</p>
+<p>同样,对于消费者和阅读者,消费者会返回一个所有 schema 记录的对象实例,而不是原始的字节:</p>
<pre><code class="hljs css language-python">consumer = client.subscribe(
topic=<span class="hljs-string">'my-topic'</span>,
subscription_name=<span class="hljs-string">'my-subscription'</span>,
@@ -178,31 +178,31 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
ex = msg.value()
<span class="hljs-keyword">try</span>:
print(<span class="hljs-string">"Received message a={} b={} c={}"</span>.format(ex.a, ex.b, ex.c))
- <span class="hljs-comment"># Acknowledge successful processing of the message</span>
+ <span class="hljs-comment"># # 确认已经成功处理了消息</span>
consumer.acknowledge(msg)
<span class="hljs-keyword">except</span>:
- <span class="hljs-comment"># Message failed to be processed</span>
+ <span class="hljs-comment"># 消息处理失败</span>
consumer.negative_acknowledge(msg)
</code></pre>
-<h3><a class="anchor" aria-hidden="true" id="supported-schema-types"></a><a href="#supported-schema-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0 [...]
-<p>There are different builtin schema types that can be used in Pulsar. All the definitions are in the <code>pulsar.schema</code> package.</p>
+<h3><a class="anchor" aria-hidden="true" id="支持的-schema-类型"></a><a href="#支持的-schema-类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>Pulsar 中可以使用的不同的内置 schema 类型。所有定义都在 <code>pulsar.schema</code> 包中。</p>
<table>
<thead>
<tr><th>Schema</th><th>备注</th></tr>
</thead>
<tbody>
-<tr><td><code>BytesSchema</code></td><td>Get the raw payload as a <code>bytes</code> object. No serialization/deserialization are performed. This is the default schema mode</td></tr>
-<tr><td><code>StringSchema</code></td><td>Encode/decode payload as a UTF-8 string. Uses <code>str</code> objects</td></tr>
-<tr><td><code>JsonSchema</code></td><td>Require record definition. Serializes the record into standard JSON payload</td></tr>
-<tr><td><code>AvroSchema</code></td><td>Require record definition. Serializes in AVRO format</td></tr>
+<tr><td><code>BytesSchema</code></td><td>默认 schema 模式,获取原始 payload 为 <code>bytes</code> 对象,不进行序列化或者反序列化。</td></tr>
+<tr><td><code>StringSchema</code></td><td>编码和解码的 payload 为 UTF-8 字符集。使用 <code>str</code> 对象</td></tr>
+<tr><td><code>JsonSchema</code></td><td>需要记录定义。将记录序列化为标准的 JSON payload</td></tr>
+<tr><td><code>AvroSchema</code></td><td>需要记录定义。序列化为 AVRO 格式。</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="schema-definition-reference"></a><a href="#schema-definition-reference" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 1 [...]
-<p>The schema definition is done through a class that inherits from <code>pulsar.schema.Record</code>.</p>
-<p>This class can have a number of fields which can be of either <code>pulsar.schema.Field</code> type or even another nested <code>Record</code>. All the fields are also specified in the <code>pulsar.schema</code> package. The fields are matching the AVRO fields types.</p>
+<h3><a class="anchor" aria-hidden="true" id="schema-定义参考"></a><a href="#schema-定义参考" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<p>schema 定义是通过继承 <code>pulsar.schema.Record</code> 类完成的。</p>
+<p>这个类可以有许多字段,可以是任何一种 <code>pulsar.schema.Field</code> 类型,甚至是 <code>Record</code> 的嵌套。 所有字段在 <code>pulsar.schema</code> 包中指定。 所有的字段匹配 AVRO 字段类型。</p>
<table>
<thead>
-<tr><th>Field Type</th><th>Python Type</th><th>备注</th></tr>
+<tr><th>字段类型</th><th>Python 类型</th><th>备注</th></tr>
</thead>
<tbody>
<tr><td><code>Boolean</code></td><td><code>bool</code></td><td></td></tr>
@@ -212,43 +212,42 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
<tr><td><code>Double</code></td><td><code>float</code></td><td></td></tr>
<tr><td><code>Bytes</code></td><td><code>bytes</code></td><td></td></tr>
<tr><td><code>String</code></td><td><code>str</code></td><td></td></tr>
-<tr><td><code>Array</code></td><td><code>list</code></td><td>Need to specify record type for items</td></tr>
-<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key is always <code>String</code>. Need to specify value type</td></tr>
+<tr><td><code>Array</code></td><td><code>list</code></td><td>需要指定标签的记录类型</td></tr>
+<tr><td><code>Map</code></td><td><code>dict</code></td><td>Key 总是 <code>String</code>类型,需要指定 value 的类型。</td></tr>
</tbody>
</table>
-<p>Additionally, any Python <code>Enum</code> type can be used as a valid field type</p>
-<h4><a class="anchor" aria-hidden="true" id="fields-parameters"></a><a href="#fields-parameters" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
-<p>When adding a field these parameters can be used in the constructor:</p>
+<p>另外,任何 Python ` Enum </ code> 类型都可以用作有效的字段类型。</p></p>
+<p><h4>字段参数</h4></p>
+<p>在添加字段时,这些参数会用于构造器:</p>
<table>
<thead>
-<tr><th>Argument</th><th>默认值</th><th>备注</th></tr>
+<tr>
+ <th>参数</th>
+ <th>默认值</th>
+ <th>备注</th>
+</tr>
</thead>
<tbody>
-<tr><td><code>default</code></td><td><code>无</code></td><td>Set a default value for the field. Eg: <code>a = Integer(default=5)</code></td></tr>
-<tr><td><code>required</code></td><td><code>False</code></td><td>Mark the field as "required". This will set it in the schema accordingly.</td></tr>
-</tbody>
-</table>
-<h4><a class="anchor" aria-hidden="true" id="schema-definition-examples"></a><a href="#schema-definition-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H [...]
-<h5><a class="anchor" aria-hidden="true" id="simple-definition"></a><a href="#simple-definition" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<tr>
+ <td><code>default`</td>
+</tr>
+</tbody> </table>
+<h4><a class="anchor" aria-hidden="true" id="schema-定义示例"></a><a href="#schema-定义示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h5><a class="anchor" aria-hidden="true" id="简单定义"></a><a href="#简单定义" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
a = String()
b = Integer()
c = Array(String())
i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="using-enums"></a><a href="#using-enums" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
-<pre><code class="hljs css language-python"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Color</span><span class="hljs-params">(Enum)</span>:</span>
- red = <span class="hljs-number">1</span>
- green = <span class="hljs-number">2</span>
- blue = <span class="hljs-number">3</span>
-
-<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
- name = String()
- color = Color
+<h5><a class="anchor" aria-hidden="true" id="使用枚举"></a><a href="#使用枚举" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Example</span><span class="hljs-params">(Record)</span>:</span>
+ a = String()
+ b = Integer()
+ c = Array(String())
+ i = Map(String())
</code></pre>
-<h5><a class="anchor" aria-hidden="true" id="complex-types"></a><a href="#complex-types" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<h5><a class="anchor" aria-hidden="true" id="复杂类型"></a><a href="#复杂类型" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<pre><code class="hljs css language-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MySubRecord</span><span class="hljs-params">(Record)</span>:</span>
x = Integer()
y = Long()
@@ -258,7 +257,7 @@ producer.send(Example(a=<span class="hljs-string">'Hello'</span>, b=<span class=
a = String()
sub = MySubRecord()
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/next/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#installation-using-pip">Installation using pip</a></li> [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-go"><span class="arrow-prev">← </span><span>Go</span></a><a class="docs-next button" href="/docs/zh-CN/next/client-libraries-cpp"><span>C++</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#安装">安装</a><ul class="toc-headings"><li><a href="#使用pip安装">使用pip安装</a></li><li><a href="#通过源代码安装">通过源代码安装 [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/next/client-libraries-websocket.html b/content/docs/zh-CN/next/client-libraries-websocket.html
index 42e1268..5a8a80f 100644
--- a/content/docs/zh-CN/next/client-libraries-websocket.html
+++ b/content/docs/zh-CN/next/client-libraries-websocket.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar的 WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/docs/z [...]
-"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar的 WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完 [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar的 WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/docs/z [...]
+"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar的 WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完 [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar的 WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar的 WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/next/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/next/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/next/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/next/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/next/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/next/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/next/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/next/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/next/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/next/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用 pull 模式 (默认: false),详见下文 "Flow Control" 。</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -293,7 +294,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -314,7 +315,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -332,9 +333,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -460,7 +461,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/next/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Brok [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/next/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar Br [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/next/client-libraries-websocket/index.html b/content/docs/zh-CN/next/client-libraries-websocket/index.html
index 42e1268..5a8a80f 100644
--- a/content/docs/zh-CN/next/client-libraries-websocket/index.html
+++ b/content/docs/zh-CN/next/client-libraries-websocket/index.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar的 WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/docs/z [...]
-"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar的 WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完 [...]
+<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Pulsar的 WebSocket API · Apache Pulsar</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全不依赖于官方<a href="/docs/z [...]
+"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="zh-CN"/><meta property="og:title" content="Pulsar的 WebSocket API · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.incubator.apache.org/"/><meta property="og:description" content="<p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完 [...]
"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.incubator.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.incubator.apache.org/blog/atom.x [...]
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -76,19 +76,19 @@
};
}
});
- </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar的 WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全 [...]
+ </script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://crowdin.com/project/apache-pulsar/zh-CN" target="_blank" rel="noreferrer noopener">Translate</a><h1 class="postHeaderTitle">Pulsar的 WebSocket API</h1></header><article><div><span><p>Pulsar 的<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">WebSocket</a> API 提供了一种简单便捷的交互方式和 Pulsar 进行交互,它完全 [...]
<blockquote>
-<p>您可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
+<p>你可以将 Pulsar 的 WebSocket API 与任何的 WebSocket 客户端库一起使用。请参阅<a href="#client-examples">下面</a>的 Python 和 Node.js 示例。</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="运行-websocket-服务"></a><a href="#运行-websocket-服务" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>我们推荐使用的Pulsar的 standalone 版本进行开发,在<a href="/docs/zh-CN/next/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
+<p>我们推荐使用的 Pulsar 的 standalone 版本进行开发,在<a href="/docs/zh-CN/next/standalone">本地开发</a> 环境启用 WebSocket 服务。</p>
<p>在非 standalone 模式下,有两种方法可以部署 WebSocket 服务:</p>
<ul>
<li><a href="#embedded-with-a-pulsar-broker">嵌入</a> Pulsar Broker</li>
<li>作为一个<a href="#as-a-separate-component">单独</a>的组件</li>
</ul>
-<h3><a class="anchor" aria-hidden="true" id="嵌入pulsar-broker"></a><a href="#嵌入pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
-<p>在此模式下,WebSocket 服务将在已经在代理中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/next/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/next/reference-configuration#broker-webSocketServiceEnabled"><code>webSocketServiceEnabled</code></a>参数。</p>
+<h3><a class="anchor" aria-hidden="true" id="嵌入-pulsar-broker"></a><a href="#嵌入-pulsar-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2. [...]
+<p>在此模式下,WebSocket 服务会在已经在 broker 中运行的同一 HTTP 服务中运行。 要启用此模式,请在安装目录下的 <a href="/docs/zh-CN/next/reference-configuration#broker"><code>conf/broker.conf</code></a> 文件中设置<a href="/docs/zh-CN/next/reference-configuration#broker-webSocketServiceEnabled"> <code>webSocketServiceEnabled</code></a> 参数。</p>
<pre><code class="hljs css language-properties"><span class="hljs-attr">webSocketServiceEnabled</span>=<span class="hljs-string">true</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="作为一个独立的组件"></a><a href="#作为一个独立的组件" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
@@ -104,7 +104,7 @@
<span class="hljs-attr">clusterName</span>=<span class="hljs-string">my-cluster</span>
</code></pre>
<h3><a class="anchor" aria-hidden="true" id="启动-broker"></a><a href="#启动-broker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.6 [...]
-<p>配置完成后,你可以使用<a href="/docs/zh-CN/next/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
+<p>配置完成后,你可以使用 <a href="/docs/zh-CN/next/reference-cli-tools#pulsar-daemon"><code>pulsar-daemon</code></a> 命令来启动服务:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> bin/pulsar-daemon start websocket</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" id="api-手册"></a><a href="#api-手册" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -120,7 +120,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
+<tr><td style="text-align:left"><code>sendTimeoutMillis</code></td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">发送超时(默认值:30秒)</td></tr>
<tr><td style="text-align:left"><code>batchingEnabled</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用批量缓存消息 (默认: false)</td></tr>
<tr><td style="text-align:left"><code>batchingMaxMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">批量允许的最大消息数(默认:1000)</td></tr>
<tr><td style="text-align:left"><code>maxPendingMessages</code></td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">设置包含消息的内部队列最大值 (默认: 1000)</td></tr>
@@ -144,11 +144,11 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
<tr><td style="text-align:left"><code>key</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">对于分区主题,决定哪些分区需要使用</td></tr>
-<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将复制限制为由 name 指定的<a href="/docs/zh-CN/next/reference-terminology#cluster">群集</a>列表</td></tr>
+<tr><td style="text-align:left"><code>replicationClusters</code></td><td style="text-align:left">array</td><td style="text-align:left">no</td><td style="text-align:left">将副本限制为由 name 指定的<a href="/docs/zh-CN/next/reference-terminology#cluster">群集</a>列表</td></tr>
</tbody>
</table>
<h5><a class="anchor" aria-hidden="true" id="示例响应成功"></a><a href="#示例响应成功" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
@@ -170,7 +170,7 @@
<tr><th style="text-align:left">Key</th><th style="text-align:left">类型</th><th style="text-align:left">是否必须?</th><th style="text-align:left">说明</th></tr>
</thead>
<tbody>
-<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code>要么成功发送,要么发送错误,要么发送不成功</td></tr>
+<tr><td style="text-align:left"><code>result</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left"><code>ok</code> 要么成功发送,要么发送错误,要么发送不成功</td></tr>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID 用来分配给已发布的消息</td></tr>
<tr><td style="text-align:left"><code>context</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的请求标识符</td></tr>
</tbody>
@@ -187,7 +187,7 @@
</thead>
<tbody>
<tr><td style="text-align:left">`ackTimeoutMillis</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未打包消息超时时间(默认值:0)</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">long</td><td style="text-align:left">no</td><td style="text-align:left">设置未完成 ACK 的超时时间(默认值:0)</td></tr>
<tr><td style="text-align:left"><code>subscriptionType</code></td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left"><a href="https://pulsar.apache.org/api/client/index.html?org/apache/pulsar/client/api/SubscriptionType.html">订阅类型</a>:<code>Exclusive</code>, <code>Failover</code>, <code>Shared</code></td></tr>
<tr><td style="text-align:left">`receiverQueueSize</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">消费者接收队列大小 (默认: 1000)</td></tr>
@@ -196,9 +196,9 @@
<tr><td style="text-align:left">`priorityLevel</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">指定消费者<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerConfiguration.html#setPriorityLevel-int-"> 优先级 </a></td></tr>
<tr><td style="text-align:left">`maxRedeliverCount</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">int</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定 <a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">maxRedeliverCount</a> (默认值:0) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left">`deadLetterTopic</td></tr>
-<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) Activates <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic">Dead Letter Topic</a> feature.</td></tr>
+<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">no</td><td style="text-align:left">为消费者指定<a href="http://pulsar.apache.org/api/client/org/apache/pulsar/client/api/ConsumerBuilder.html#deadLetterPolicy-org.apache.pulsar.client.api.DeadLetterPolicy-">deadLetterTopic</a> (默认值:{topic}-{subscription}-DLQ) 激活 <a href="https://github.com/apache/pulsar/wiki/PIP-22%3A-Pulsar-Dead-Letter-Topic"> Dead Letter Topic </a> 功能。</td></tr>
<tr><td style="text-align:left"><code>pullMode</code></td><td style="text-align:left">boolean</td><td style="text-align:left">no</td><td style="text-align:left">启用 pull 模式 (默认: false),详见下文 "Flow Control" 。</td></tr>
</tbody>
</table>
@@ -219,7 +219,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -242,9 +242,10 @@
</table>
<h4><a class="anchor" aria-hidden="true" id="flow-control"></a><a href="#flow-control" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<h5><a class="anchor" aria-hidden="true" id="push-模式"></a><a href="#push-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>默认情况下(<code>pullMode = false </ code>),消费者端将使用 <code> receiverQueueSize </ code> 参数来调整其大小 内部接收队列,并限制传递给 WebSocket 客户端的未确认消息的数量。 在这个模式下,如果你不发送确认,Pulsar WebSocket 服务将在到达 之后停止发送消息 <code>receiverQueueSize</code> 未发送到WebSocket客户端。</p>
-<h5><a class="anchor" aria-hidden="true" id="pull-模式"></a><a href="#pull-模式" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
-<p>如果你设置了 <code>pullMode</code> <code>true</code>,WebSocket 客户端将需要发送 <code>permit</code> 命令允许 Pulsar WebSocket 服务发送更多消息。</p>
+<p>默认情况下(` pullMode = false </ code>),消费者端会使用 <code> receiverQueueSize </ code> 参数来调整其内部接收队列的大小,并限制传递给 WebSocket 客户端的未确认消息的数量。
+在这个模式下,如果不发送 ACK 确认,Pulsar WebSocket 服务将在到达发送到 WebSocket 客户端的 receiverQueueSize 设置大小的未确认消息后停止发送消息。</p></p>
+<p><h5>Pull 模式</h5></p>
+<p>如果你设置了 <code>pullMode` `true`,WebSocket 客户端需要发送 `permit` 命令允许 Pulsar WebSocket 服务发送更多消息。
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"type"</span>: <span class="hljs-string">"permit"</span>,
<span class="hljs-attr">"permitMessages"</span>: <span class="hljs-number">100</span>
@@ -293,7 +294,7 @@
</thead>
<tbody>
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Message ID</td></tr>
-<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的有效载荷</td></tr>
+<tr><td style="text-align:left"><code>payload</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">Base-64 编码的 payload</td></tr>
<tr><td style="text-align:left">`publishTime</td></tr>
<tr><td style="text-align:left">`</td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">发布时间戳</td></tr>
<tr><td style="text-align:left"><code>properties</code></td><td style="text-align:left">key-value</td><td style="text-align:left">no</td><td style="text-align:left">应用程序定义的属性</td></tr>
@@ -314,7 +315,7 @@
<tr><td style="text-align:left"><code>messageId</code></td><td style="text-align:left">string</td><td style="text-align:left">yes</td><td style="text-align:left">处理消息的消息ID</td></tr>
</tbody>
</table>
-<h3><a class="anchor" aria-hidden="true" id="error-codes"></a><a href="#error-codes" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42 [...]
+<h3><a class="anchor" aria-hidden="true" id="错误代码"></a><a href="#错误代码" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
<p>In case of error the server will close the WebSocket session using the following error codes:</p>
<table>
<thead>
@@ -332,9 +333,9 @@
</tbody>
</table>
<blockquote>
-<p>The application is responsible for re-establishing a new WebSocket session after a backoff period.</p>
+<p>应用程序负责在后台重新建立新的 WebSocket 会话。</p>
</blockquote>
-<h2><a class="anchor" aria-hidden="true" id="client-examples"></a><a href="#client-examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 [...]
+<h2><a class="anchor" aria-hidden="true" id="客户端示例"></a><a href="#客户端示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
<p>Below you'll find code examples for the Pulsar WebSocket API in <a href="#python">Python</a> and <a href="#nodejs">Node.js</a>.</p>
<h3><a class="anchor" aria-hidden="true" id="python"></a><a href="#python" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2. [...]
<p>This example uses the <a href="https://pypi.python.org/pypi/websocket-client"><code>websocket-client</code></a> package. You can install it using <a href="https://pypi.python.org/pypi/pip">pip</a>:</p>
@@ -460,7 +461,7 @@ ws.on(<span class="hljs-string">'message'</span>, <span class="hljs-function"><s
ws.send(<span class="hljs-built_in">JSON</span>.stringify(ackMsg));
});
</code></pre>
-</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/next/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入pulsar-broker">嵌入Pulsar Brok [...]
+</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/zh-CN/next/client-libraries-cpp"><span class="arrow-prev">← </span><span>C++</span></a><a class="docs-next button" href="/docs/zh-CN/next/admin-api-overview"><span>概述</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#运行-websocket-服务">运行 WebSocket 服务</a><ul class="toc-headings"><li><a href="#嵌入-pulsar-broker">嵌入 Pulsar Br [...]
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
diff --git a/content/docs/zh-CN/next/cookbooks-retention-expiry.html b/content/docs/zh-CN/next/cookbooks-retention-expiry.html
index 238eb79..13bcc2a 100644
--- a/content/docs/zh-CN/next/cookbooks-retention-expiry.html
+++ b/content/docs/zh-CN/next/cookbooks-retention-expiry.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/next/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/docs/zh-CN/next/cookbooks-retention-expiry/index.html b/content/docs/zh-CN/next/cookbooks-retention-expiry/index.html
index 238eb79..13bcc2a 100644
--- a/content/docs/zh-CN/next/cookbooks-retention-expiry/index.html
+++ b/content/docs/zh-CN/next/cookbooks-retention-expiry/index.html
@@ -106,7 +106,7 @@
<p>通过指定命名空间上的大小限制<em>和</em>时间限制来为命名空间设置保留策略。</p>
<h4><a class="anchor" aria-hidden="true" id="pulsar-admin"></a><a href="#pulsar-admin" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83. [...]
<p>使用<a href="/docs/zh-CN/next/pulsar-admin#namespaces-set-retention"><code>set-retention</code></a>子命令并指定命名空间,使用<code>-s</code>/<code>--size</code>参数指定大小限制,使用<code>-t</code>/<code>--time</code>参数指定时间限制。</p>
-<h5><a class="anchor" aria-hidden="true" id="examples"></a><a href="#examples" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 [...]
+<h5><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
<p>为 <code>my-tenant/my-ns</code> 命名空间设置10的大小限制和3小时的时间限制:</p>
<pre><code class="hljs css language-shell"><span class="hljs-meta">$</span><span class="bash"> pulsar-admin namespaces <span class="hljs-built_in">set</span>-retention my-tenant/my-ns \</span>
--size 10G \
diff --git a/content/swagger/2.4.0-SNAPSHOT/swagger.json b/content/swagger/2.4.0-SNAPSHOT/swagger.json
index 3728528..0addb18 100644
--- a/content/swagger/2.4.0-SNAPSHOT/swagger.json
+++ b/content/swagger/2.4.0-SNAPSHOT/swagger.json
@@ -7273,19 +7273,28 @@
"type" : "number",
"format" : "double"
},
+ "overLoaded" : {
+ "type" : "boolean"
+ },
+ "underLoaded" : {
+ "type" : "boolean"
+ },
+ "loadReportType" : {
+ "type" : "string"
+ },
"cpu" : {
"$ref" : "#/definitions/ResourceUsage"
},
- "memory" : {
+ "bandwidthOut" : {
"$ref" : "#/definitions/ResourceUsage"
},
- "directMemory" : {
+ "memory" : {
"$ref" : "#/definitions/ResourceUsage"
},
"bandwidthIn" : {
"$ref" : "#/definitions/ResourceUsage"
},
- "bandwidthOut" : {
+ "directMemory" : {
"$ref" : "#/definitions/ResourceUsage"
},
"lastUpdate" : {
@@ -7299,15 +7308,6 @@
"msgThroughputOut" : {
"type" : "number",
"format" : "double"
- },
- "overLoaded" : {
- "type" : "boolean"
- },
- "underLoaded" : {
- "type" : "boolean"
- },
- "loadReportType" : {
- "type" : "string"
}
}
},
@@ -7470,10 +7470,10 @@
"connectedSince" : {
"type" : "string"
},
- "clientVersion" : {
+ "producerName" : {
"type" : "string"
},
- "producerName" : {
+ "clientVersion" : {
"type" : "string"
},
"address" : {
@@ -8141,10 +8141,10 @@
"connectedSince" : {
"type" : "string"
},
- "clientVersion" : {
+ "producerName" : {
"type" : "string"
},
- "producerName" : {
+ "clientVersion" : {
"type" : "string"
},
"address" : {
@@ -8246,11 +8246,11 @@
"ResourceUnit" : {
"type" : "object",
"properties" : {
- "availableResource" : {
- "$ref" : "#/definitions/ResourceDescription"
- },
"resourceId" : {
"type" : "string"
+ },
+ "availableResource" : {
+ "$ref" : "#/definitions/ResourceDescription"
}
}
},
diff --git a/content/swagger/2.4.0-SNAPSHOT/swaggerfunctions.json b/content/swagger/2.4.0-SNAPSHOT/swaggerfunctions.json
index feb7c77..d8b30f4 100644
--- a/content/swagger/2.4.0-SNAPSHOT/swaggerfunctions.json
+++ b/content/swagger/2.4.0-SNAPSHOT/swaggerfunctions.json
@@ -1348,17 +1348,6 @@
"Message" : {
"type" : "object",
"properties" : {
- "publishTime" : {
- "type" : "integer",
- "format" : "int64"
- },
- "eventTime" : {
- "type" : "integer",
- "format" : "int64"
- },
- "topicName" : {
- "type" : "string"
- },
"messageId" : {
"$ref" : "#/definitions/MessageId"
},
@@ -1366,12 +1355,8 @@
"type" : "integer",
"format" : "int64"
},
- "keyBytes" : {
- "type" : "array",
- "items" : {
- "type" : "string",
- "format" : "byte"
- }
+ "producerName" : {
+ "type" : "string"
},
"orderingKey" : {
"type" : "array",
@@ -1394,9 +1379,24 @@
"format" : "byte"
}
},
- "producerName" : {
+ "publishTime" : {
+ "type" : "integer",
+ "format" : "int64"
+ },
+ "eventTime" : {
+ "type" : "integer",
+ "format" : "int64"
+ },
+ "topicName" : {
"type" : "string"
},
+ "keyBytes" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string",
+ "format" : "byte"
+ }
+ },
"data" : {
"type" : "array",
"items" : {