You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ja...@apache.org on 2020/03/27 02:02:05 UTC

[flink] branch master updated: [FLINK-16128][docs-zh] Translate "Google Cloud PubSub" page into Chinese

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

jark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 66c2913  [FLINK-16128][docs-zh] Translate "Google Cloud PubSub" page into Chinese
66c2913 is described below

commit 66c2913742c2d6e92042c7466a398fb0f468d6b3
Author: Xuannan <su...@gmail.com>
AuthorDate: Fri Mar 27 10:01:51 2020 +0800

    [FLINK-16128][docs-zh] Translate "Google Cloud PubSub" page into Chinese
    
    This closes #11151
---
 docs/dev/connectors/pubsub.md    |  4 +--
 docs/dev/connectors/pubsub.zh.md | 54 +++++++++++++++++-----------------------
 2 files changed, 25 insertions(+), 33 deletions(-)

diff --git a/docs/dev/connectors/pubsub.md b/docs/dev/connectors/pubsub.md
index 59b3e00..6055d9f 100644
--- a/docs/dev/connectors/pubsub.md
+++ b/docs/dev/connectors/pubsub.md
@@ -143,13 +143,13 @@ env.addSource(pubsubSource)
 </div>
 </div>
 
-### Atleast once guarantee
+### At least once guarantee
 
 #### SourceFunction
 
 There are several reasons why a message might be send multiple times, such as failure scenarios on Google PubSub's side.
 
-Another reason is when the acknowledgement deadline has passed. This is the time between receiving the message and between acknowledging the message. The PubSubSource will only acknowledge a message on successful checkpoints to guarantee Atleast-Once. This does mean if the time between successful checkpoints is larger than the acknowledgment deadline of your subscription messages will most likely be processed multiple times.
+Another reason is when the acknowledgement deadline has passed. This is the time between receiving the message and acknowledging the message. The PubSubSource will only acknowledge a message on successful checkpoints to guarantee at-least-once. This does mean if the time between successful checkpoints is larger than the acknowledgment deadline of your subscription messages will most likely be processed multiple times.
 
 For this reason it's recommended to have a (much) lower checkpoint interval than acknowledgement deadline.
 
diff --git a/docs/dev/connectors/pubsub.zh.md b/docs/dev/connectors/pubsub.zh.md
index 59b3e00..eaf5f58 100644
--- a/docs/dev/connectors/pubsub.zh.md
+++ b/docs/dev/connectors/pubsub.zh.md
@@ -23,9 +23,7 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-This connector provides a Source and Sink that can read from and write to
-[Google Cloud PubSub](https://cloud.google.com/pubsub). To use this connector, add the
-following dependency to your project:
+这个连接器可向 [Google Cloud PubSub](https://cloud.google.com/pubsub) 读取与写入数据。添加下面的依赖来使用此连接器:
 
 {% highlight xml %}
 <dependency>
@@ -36,27 +34,20 @@ following dependency to your project:
 {% endhighlight %}
 
 <p style="border-radius: 5px; padding: 5px" class="bg-danger">
-<b>Note</b>: This connector has been added to Flink recently. It has not received widespread testing yet.
+<b>注意</b>:此连接器最近才加到 Flink 里,还未接受广泛测试。
 </p>
 
-Note that the streaming connectors are currently not part of the binary
-distribution. See
-[here]({{ site.baseurl }}/dev/projectsetup/dependencies.html)
-for information about how to package the program with the libraries for
-cluster execution.
-
-
+注意连接器目前还不是二进制发行版的一部分,添加依赖、打包配置以及集群运行信息请参考[这里]({{ site.baseurl }}/zh/dev/projectsetup/dependencies.html)
 
 ## Consuming or Producing PubSubMessages
 
-The connector provides a connectors for receiving and sending messages from and to Google PubSub.
-Google PubSub has an `at-least-once` guarantee and as such the connector delivers the same guarantees.
+连接器可以接收和发送 Google PubSub 的信息。和 Google PubSub 一样,这个连接器能够保证`至少一次`的语义。
 
 ### PubSub SourceFunction
 
-The class `PubSubSource` has a builder to create PubSubsources: `PubSubSource.newBuilder(...)`
+`PubSubSource` 类的对象由构建类来构建: `PubSubSource.newBuilder(...)`
 
-There are several optional methods to alter how the PubSubSource is created, the bare minimum is to provide a Google project, Pubsub subscription and a way to deserialize the PubSubMessages.
+有多种可选的方法来创建 PubSubSource,但最低要求是要提供 Google Project、Pubsub 订阅和反序列化 PubSubMessages 的方法。
 
 Example:
 
@@ -77,13 +68,13 @@ streamExecEnv.addSource(source);
 </div>
 </div>
 
-Currently the source functions [pulls](https://cloud.google.com/pubsub/docs/pull) messages from PubSub, [push endpoints](https://cloud.google.com/pubsub/docs/push) are not supported.
+当前还不支持 PubSub 的 source functions [pulls](https://cloud.google.com/pubsub/docs/pull) messages 和 [push endpoints](https://cloud.google.com/pubsub/docs/push)。
 
 ### PubSub Sink
 
-The class `PubSubSink` has a builder to create PubSubSinks. `PubSubSink.newBuilder(...)`
+`PubSubSink` 类的对象由构建类来构建: `PubSubSink.newBuilder(...)`
 
-This builder works in a similar way to the PubSubSource.
+构建类的使用方式与 PubSubSource 类似。
 
 Example:
 
@@ -106,17 +97,18 @@ dataStream.addSink(pubsubSink);
 
 ### Google Credentials
 
-Google uses [Credentials](https://cloud.google.com/docs/authentication/production) to authenticate and authorize applications so that they can use Google Cloud Platform resources (such as PubSub).
+应用程序需要使用 [Credentials](https://cloud.google.com/docs/authentication/production) 来通过认证和授权才能使用 Google Cloud Platform 的资源,例如 PubSub。
+
+上述的两个构建类都允许你提供 Credentials, 但是连接器默认会通过环境变量: [GOOGLE_APPLICATION_CREDENTIALS](https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually) 来获取 Credentials 的路径。
 
-Both builders allow you to provide these credentials but by default the connectors will look for an environment variable: [GOOGLE_APPLICATION_CREDENTIALS](https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually) which should point to a file containing the credentials.
+如果你想手动提供 Credentials,例如你想从外部系统读取 Credentials,你可以使用 `PubSubSource.newBuilder(...).withCredentials(...)`。
 
-If you want to provide Credentials manually, for instance if you read the Credentials yourself from an external system, you can use `PubSubSource.newBuilder(...).withCredentials(...)`.
+### 集成测试
 
-### Integration testing
+在集成测试的时候,如果你不想直接连 PubSub 而是想读取和写入一个 docker container,可以参照 [PubSub testing locally](https://cloud.google.com/pubsub/docs/emulator)。
 
-When running integration tests you might not want to connect to PubSub directly but use a docker container to read and write to. (See: [PubSub testing locally](https://cloud.google.com/pubsub/docs/emulator))
+下面的例子展示了如何使用 source 来从仿真器读取信息并发送回去:
 
-The following example shows how you would create a source to read messages from the emulator and send them back:
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
 {% highlight java %}
@@ -143,22 +135,22 @@ env.addSource(pubsubSource)
 </div>
 </div>
 
-### Atleast once guarantee
+### 至少一次语义保证
 
 #### SourceFunction
 
-There are several reasons why a message might be send multiple times, such as failure scenarios on Google PubSub's side.
+有很多原因导致会一个信息会被多次发出,例如 Google PubSub 的故障。
 
-Another reason is when the acknowledgement deadline has passed. This is the time between receiving the message and between acknowledging the message. The PubSubSource will only acknowledge a message on successful checkpoints to guarantee Atleast-Once. This does mean if the time between successful checkpoints is larger than the acknowledgment deadline of your subscription messages will most likely be processed multiple times.
+另一个可能的原因是超过了确认的截止时间,即收到与确认信息之间的时间间隔。PubSubSource 只有在信息被成功快照之后才会确认以保证至少一次的语义。这意味着,如果你的快照间隔大于信息确认的截止时间,那么你订阅的信息很有可能会被多次处理。
 
-For this reason it's recommended to have a (much) lower checkpoint interval than acknowledgement deadline.
+因此,我们建议把快照的间隔设置得比信息确认截止时间更短。
 
-See [PubSub](https://cloud.google.com/pubsub/docs/subscriber) for details on how to increase the acknowledgment deadline of your subscription.
+参照 [PubSub](https://cloud.google.com/pubsub/docs/subscriber) 来增加信息确认截止时间。
 
-Note: The metric `PubSubMessagesProcessedNotAcked` shows how many messages are waiting for the next checkpoint before they will be acknowledged.
+注意: `PubSubMessagesProcessedNotAcked` 显示了有多少信息正在等待下一个 checkpoint 还没被确认。
 
 #### SinkFunction
 
-The sink function buffers messages that are to be send to PubSub for a short amount of time for performance reasons. Before each checkpoint this buffer is flushed and the checkpoint will not succeed unless the messages have been delivered to PubSub.
+Sink function 会把准备发到 PubSub 的信息短暂地缓存以提高性能。每次 checkpoint 前,它会刷新缓冲区,并且只有当所有信息成功发送到 PubSub 之后,checkpoint 才会成功完成。
 
 {% top %}