This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch new-official-website
in repository https://gitbox.apache.org/repos/asf/rocketmq-site.git
The following commit(s) were added to refs/heads/new-official-website by this
push:
new bcfef138e [ISSUE #294]Translation for "Best Practices-订阅关系一致" Section
in the v4.x & 5.0 Document (CN -> EN) (#413)
bcfef138e is described below
commit bcfef138ecd55707a0e10c5cd21d3511faeeb0a9
Author: mxsm <[email protected]>
AuthorDate: Sat Jan 7 15:47:58 2023 +0800
[ISSUE #294]Translation for "Best Practices-订阅关系一致" Section in the v4.x &
5.0 Document (CN -> EN) (#413)
---
.../current/05-bestPractice/21subscribe.md | 134 ++++++++++-----------
.../version-5.0/06-bestPractice/21subscribe.md | 96 +++++++--------
2 files changed, 109 insertions(+), 121 deletions(-)
diff --git
a/i18n/en/docusaurus-plugin-content-docs/current/05-bestPractice/21subscribe.md
b/i18n/en/docusaurus-plugin-content-docs/current/05-bestPractice/21subscribe.md
index b7cb1febf..9699961a3 100644
---
a/i18n/en/docusaurus-plugin-content-docs/current/05-bestPractice/21subscribe.md
+++
b/i18n/en/docusaurus-plugin-content-docs/current/05-bestPractice/21subscribe.md
@@ -1,28 +1,22 @@
-# 订阅关系一致
+# Consistent subscription relationship
-## 前言
+## Introduction
-订阅关系:一个消费者组订阅一个 Topic 的某一个 Tag,这种记录被称为订阅关系。
+Subscription relationship: a consumer group subscribes to a particular Tag of
a Topic, this record is called a subscription relationship.
-订阅关系一致:同一个消费者组下所有消费者实例所订阅的Topic、Tag必须完全一致。如果订阅关系(消费者组名-Topic-Tag)不一致,会导致消费消息紊乱,甚至消息丢失。
+Consistent subscription relationship: all consumer instances in the same
consumer group must have the exact same subscription to the Topic and Tag. If
the subscription relationship (consumer group name-Topic-Tag) is not
consistent, it can cause confusion when consuming messages and may even result
in message loss.
-## 1 正确订阅关系示例
+## 1 Examples of correct subscription relationships
+### 1.1 Subscribe to a Topic and subscribe to a Tag
-
-### 1.1 订阅一个Topic且订阅一个Tag
-
-如下图所示,同一Group
ID下的三个Consumer实例C1、C2和C3分别都订阅了TopicA,且订阅TopicA的Tag也都是Tag1,符合订阅关系一致原则。
+As shown in the following figure, three Consumer instances C1, C2, and C3 in
the same Group ID have all subscribed to TopicA, and the Tag of their
subscription to TopicA is also Tag1, which conforms to the principle of
consistent subscription.

+**Correct example code 1:**
-
-
-
-**正确示例代码一**
-
-C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须完全一致,代码示例如下:
+The subscription relationships of C1, C2, and C3 are consistent, meaning the
code for subscribing to messages for C1, C2, and C3 must be exactly the same,
and the code example is as follows:
```java
Properties properties = new Properties();
@@ -36,15 +30,15 @@ C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须
});
```
-### 1.2 订阅一个Topic且订阅多个Tag
+### 1.2 Subscribe to a Topic and subscribe to multiple Tags
-如下图所示,同一Group
ID下的三个Consumer实例C1、C2和C3分别都订阅了TopicB,订阅TopicB的Tag也都是Tag2和Tag3,表示订阅TopicB中所有Tag为Tag2或Tag3的消息,且顺序一致都是Tag2||Tag3,符合订阅关系一致性原则。
+As shown in the following figure, the three Consumer instances C1, C2, and C3
in the same Group ID have all subscribed to TopicB and have subscribed to Tag2
and Tag3 for TopicB, which means they have subscribed to all messages in TopicB
with Tag2 or Tag3, and the order is consistent as Tag2||Tag3, meeting the
principle of subscription relationship consistency.

-**正确示例代码二**
+**Correct example code 2:**
-C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须完全一致,代码示例如下:
+The subscription relationships of C1, C2, and C3 are consistent, meaning the
code for subscribing to messages for C1, C2, and C3 must be exactly the same,
and the code example is as follows:
```java
Properties properties = new Properties();
@@ -58,15 +52,15 @@ C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须
});
```
-### 1.3 订阅多个Topic且订阅多个Tag
+### 1.3 Subscribe to multiple Topics and subscribe to multiple Tags
-如下图所示,同一Group
ID下的三个Consumer实例C1、C2和C3分别都订阅了TopicA和TopicB,且订阅的TopicA都未指定Tag,即订阅TopicA中的所有消息,订阅的TopicB的Tag都是Tag1和Tag2,表示订阅TopicB中所有Tag为Tag1或Tag2的消息,且顺序一致都是Tag1||Tag2,符合订阅关系一致原则。
+As shown in the following figure, the three Consumer instances C1, C2, and C3
in the same Group ID have all subscribed to TopicA and TopicB, and their
subscription to TopicA does not specify any Tag, which means they subscribe to
all messages in TopicA, and their subscription to TopicB's Tag is Tag1 and
Tag2, which means they subscribe to all messages in TopicB with Tag1 or Tag2,
and the order is consistent as Tag1||Tag2, meeting the principle of
subscription relationship consistency.

-**正确示例代码三**
+**Correct example code 3:**
-C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须完全一致,代码示例如下:
+The subscription relationships of C1, C2, and C3 are consistent, meaning the
code for subscribing to messages for C1, C2, and C3 must be exactly the same,
and the code example is as follows:
```java
Properties properties = new Properties();
@@ -86,36 +80,36 @@ C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须
});
```
-## 2 订阅关系不一致的排查
+## 2 Troubleshooting inconsistent subscription relationships
-**问题描述**
+**Problem description**
-在使用消息队列RocketMQ版实例时,可能会出现订阅关系不一致的情况,具体的问题现象如下:
+When using the RocketMQ version of the message queue, it is possible to have
inconsistent subscription relationships. The specific problems are as follows:
-- 消息队列RocketMQ版控制台中订阅关系是否一致显示为否。
-- 消费者(Consumer)实例未收到订阅的消息。
+- The consistency of subscription relationships in the RocketMQ version of the
message queue console is displayed as no.
+- Consumer instances do not receive subscribed messages.
-**请参考以下步骤进行检查**
+**Please refer to the following steps for checking**
-您可在消息消息队列RocketMQ版控制台Group 详情页面查看指定Group的订阅关系是否一致。若查询结果不一致,请参见本文(3
常见订阅关系不一致问题)排查Consumer实例的消费代码。
+You can check the consistency of the subscription relationship of the
specified Group on the Group Details page of the RocketMQ version of the
message queue console. If the query result is inconsistent, please refer to
section 3 of this article to troubleshoot the consumption code of the Consumer
instance.
-1. 检查您Consumer实例中与订阅相关的配置代码,确保配置同一个Group ID的所有Consumer实例均订阅相同的Topic及Tag。
-2. 重启客户端应用。
-3.
登录[消息队列RocketMQ版控制台](https://ons.console.aliyun.com/),在左侧导航栏中单击实例列表,选择您的目标实例,进入实例详情页面。
-4. 在左侧导航栏中单击Group管理,选择对应的协议后,单击消费者状态,确认订阅关系是否一致显示为是。
-5. 测试并确认消息能够被预期的Consumer实例所消费。
+1. Check the configuration code related to subscription in your Consumer
instance to ensure that all Consumer instances with the same Group ID subscribe
to the same Topic and Tag.
+2. Restart the client application.
+3. Log in to the [RocketMQ version of the message queue
console](https://ons.console.aliyun.com/) and click the instance list in the
left navigation bar. Select your target instance and enter the instance details
page.
+4. Click Group Management in the left navigation bar, select the corresponding
protocol, and then click Consumer Status to confirm that the consistency of the
subscription relationship is displayed as Yes.
+5. Test and confirm that the message can be consumed by the expected consumer
instance.
-## 3 常见订阅关系不一致问题
+## 3 Common issues with inconsistent subscription relationships
-### 3.1 同一Group ID下的Consumer实例订阅的Topic不同
+### 3.1 Consumer instances with the same Group ID subscribe to different
Topics
-如下图所示,同一Group
ID下的三个Consumer实例C1、C2和C3分别订阅了TopicA、TopicB和TopicC,订阅的Topic不一致,不符合订阅关系一致性原则。
+As shown in the following figure, the three Consumer instances C1, C2, and C3
in the same Group ID have subscribed to TopicA, TopicB, and TopicC,
respectively, and their subscriptions to the Topics are not the same, which
does not meet the principle of subscription relationship consistency.

-**错误示例代码一**
+**Error example code 1**
-+ Consumer实例1-1:
++ Consumer example 1-1:
```java
Properties properties = new Properties();
@@ -129,43 +123,43 @@ C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须
});
```
-+ Consumer实例1-2:
++ Consumer example 1-2:
-```java
- Properties properties = new Properties();
- properties.put(PropertyKeyConst.GROUP_ID, "GID_test_1");
- Consumer consumer = ONSFactory.createConsumer(properties);
- consumer.subscribe("TopicB", "*", new MessageListener() {
- public Action consume(Message message, ConsumeContext context) {
- System.out.println(message.getMsgID());
- return Action.CommitMessage;
- }
- });
-```
+ ```java
+ Properties properties = new Properties();
+ properties.put(PropertyKeyConst.GROUP_ID, "GID_test_1");
+ Consumer consumer = ONSFactory.createConsumer(properties);
+ consumer.subscribe("TopicB", "*", new MessageListener() {
+ public Action consume(Message message, ConsumeContext context) {
+ System.out.println(message.getMsgID());
+ return Action.CommitMessage;
+ }
+ });
+ ```
-+ Consumer实例1-3:
++ Consumer example 1-3:
-```java
- Properties properties = new Properties();
- properties.put(PropertyKeyConst.GROUP_ID, "GID_test_1");
- Consumer consumer = ONSFactory.createConsumer(properties);
- consumer.subscribe("TopicC", "*", new MessageListener() {
- public Action consume(Message message, ConsumeContext context) {
- System.out.println(message.getMsgID());
- return Action.CommitMessage;
- }
- });
-```
+ ```java
+ Properties properties = new Properties();
+ properties.put(PropertyKeyConst.GROUP_ID, "GID_test_1");
+ Consumer consumer = ONSFactory.createConsumer(properties);
+ consumer.subscribe("TopicC", "*", new MessageListener() {
+ public Action consume(Message message, ConsumeContext context) {
+ System.out.println(message.getMsgID());
+ return Action.CommitMessage;
+ }
+ });
+ ```
-### 3.2 同一Group ID下的Consumer实例订阅的Topic相同,但订阅的Tag不一致
+### 3.2 Consumer instances with the same Group ID subscribe to the same Topic,
but their subscriptions to the Tag are different
-如下图所示,同一Group
ID下的三个Consumer实例C1、C2和C3分别都订阅了TopicA,但是C1订阅TopicA的Tag为**Tag1**,C2和C3订阅的TopicA的Tag为**Tag2**,订阅同一Topic的Tag不一致,不符合订阅关系一致性原则。
+As shown in the following figure, the three Consumer instances C1, C2, and C3
in the same Group ID have all subscribed to TopicA, but C1 subscribes to Tag1
for TopicA, C2 and C3 subscribe to Tag2 for TopicA, and the subscriptions to
the same Topic's Tag are not the same, which does not meet the principle of
subscription relationship consistency.

-**错误示例代码二**
+**Error example code 2**
-+ Consumer实例2-1:
++ Consumer example 2-1:
```java
Properties properties = new Properties();
@@ -181,7 +175,7 @@ C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须
-+ Consumer实例2-2:
++ Consumer example 2-2:
```java
Properties properties = new Properties();
@@ -195,7 +189,7 @@ C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须
});
```
-+ Consumer实例2-3:
++ Consumer example 2-3:
```java
Properties properties = new Properties();
diff --git
a/i18n/en/docusaurus-plugin-content-docs/version-5.0/06-bestPractice/21subscribe.md
b/i18n/en/docusaurus-plugin-content-docs/version-5.0/06-bestPractice/21subscribe.md
index 8c237124c..7d81a7b56 100644
---
a/i18n/en/docusaurus-plugin-content-docs/version-5.0/06-bestPractice/21subscribe.md
+++
b/i18n/en/docusaurus-plugin-content-docs/version-5.0/06-bestPractice/21subscribe.md
@@ -1,100 +1,94 @@
-# 订阅关系一致
+# Consistent subscription relationship
-## 前言
+## Introduction
-订阅关系是 RocketMQ
领域模型中非常重要的环节,用于表达消费者消费消息的控制元数据,完整的概念请参考[订阅关系模型](../03-domainModel/09subscription.md)。
+Subscription relationships are a very important part of the RocketMQ domain
model, used to express the control metadata for consumer consumption of
messages. For a complete concept, please refer to [Subscription Relationship
Model](../03-domainModel/09subscription.md).
-订阅关系一致是指,同一个消费者组下所有消费者实例所订阅的Topic、Tag必须完全一致。如果订阅关系(消费者分组名-Topic-Tag)不一致,会导致消费消息紊乱,甚至消息丢失。
+Subscription relationships are consistent when all Consumer instances in the
same consumer group have exactly the same subscriptions to Topic and Tag. If
the subscription relationships (consumer group name-Topic-Tag) are not
consistent, it can lead to confusion in consuming messages and even loss of
messages.
-## 1 正确订阅关系示例
+## 1 Examples of correct subscription relationships
-### 1.1 订阅的Topic一样,且过滤表达式一致
+### 1.1 Topics subscribed to are the same and the filter expressions are
consistent
-如下图所示,同一 ConsumerGroup
下的三个Consumer实例C1、C2和C3分别都订阅了TopicA,且订阅TopicA的Tag也都是Tag1,符合订阅关系一致原则。
+As shown in the following figure, the three Consumer instances C1, C2, and C3
in the same ConsumerGroup have all subscribed to TopicA, and the subscriptions
to TopicA's Tag are all Tag1, which meets the principle of subscription
relationship consistency.

+**Correct example code 1:**
-**正确示例代码一**
-
-C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须完全一致,代码示例如下:
+C1, C2, and C3's subscription relationships are consistent, meaning that C1,
C2, and C3's code for subscribing to messages must be exactly the same, and the
code example is as follows:
```java
- PushConsumer consumer1 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
- consumer1.subscribe("TopicA", new FilterExpression("TagA",
FilterExpressionType.TAG));
-
- PushConsumer consumer2 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
- consumer2.subscribe("TopicA", new FilterExpression("TagA",
FilterExpressionType.TAG));
-
- PushConsumer consumer3 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
- consumer3.subscribe("TopicA", new FilterExpression("TagA",
FilterExpressionType.TAG));
+PushConsumer consumer1 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
+consumer1.subscribe("TopicA", new FilterExpression("TagA",
FilterExpressionType.TAG));
+
+PushConsumer consumer2 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
+consumer2.subscribe("TopicA", new FilterExpression("TagA",
FilterExpressionType.TAG));
+
+PushConsumer consumer3 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
+consumer3.subscribe("TopicA", new FilterExpression("TagA",
FilterExpressionType.TAG));
```
:::info
-RocketMQ 强调订阅关系一致,核心是指相同 ConsumerGroup 的每个 Consumer 之间一致,因为在服务端视角看来一个 Group
下的所有 Consumer 都应该是相同的副本逻辑。
+RocketMQ emphasizes consistency in subscription relationships, which means
that every Consumer within the same ConsumerGroup should be consistent, because
from the perspective of the server, all Consumers in a Group should be the same
logical copy.
-强调订阅关系一致,并不是指一个 Consumer 不能订阅多个Topic,每个 Consumer 仍然可以按照需要订阅多个
Topic,但前提是相同消费者分组下的 Consumer 要一致。
+Emphasis on consistency in subscription relationships does not mean that a
Consumer cannot subscribe to multiple Topics, and each Consumer can still
subscribe to multiple Topics as needed, but the premise is that Consumers
within the same consumer group must be consistent.
:::
-## 2 订阅关系不一致的排查
+## 2 Troubleshooting inconsistent subscription relationships
-**问题描述**
+**Problem description**
-在使用 Apache RocketMQ 时,可能会出现订阅关系不一致的情况,具体的问题现象如下:
+When using the RocketMQ version of the message queue, it is possible to have
inconsistent subscription relationships. The specific problems are as follows:
-- Apache RocketMQ 控制台中订阅关系是否一致显示为否。
-- 消费者(Consumer)实例未收到订阅的消息。
+- The consistency of subscription relationships in the RocketMQ version of the
message queue console is displayed as no.
+- Consumer instances do not receive subscribed messages.
-**请参考以下步骤进行检查**
+**Please refer to the following steps for checking**
-您可在消息Apache RocketMQ的控制台或者CLi工具查看指定Group的订阅关系是否一致。若查询结果不一致,请参见本文(3
常见订阅关系不一致问题)排查Consumer实例的消费代码。
+You can check whether the subscription relationship of the specified Group is
consistent in the Apache RocketMQ console or CLi tool. If the query result is
inconsistent, please refer to the common subscription relationship
inconsistency problems in this article to troubleshoot the consumption code of
the Consumer instance.
-1. 检查您Consumer实例中与订阅相关的配置代码,确保配置同一个 ConsumerGroup 的所有Consumer实例均订阅相同的Topic及Tag。
-2. 使用控制台或者Cli命令ConsumerConnection 查看生效的订阅关系是否一致。
-3. 测试并确认消息能够被预期的Consumer实例所消费。
+1. Check the configuration code related to subscription in your Consumer
instance to ensure that all Consumer instances in the same ConsumerGroup
subscribe to the same Topic and Tag.
+2. Use the console or Cli command ConsumerConnection to check if the effective
subscription relationship is consistent.
+3. Test and confirm that the message can be consumed by the expected Consumer
instance.
-## 3 常见订阅关系不一致问题
+## 3 Common issues with inconsistent subscription relationships
-### 3.1 同一ConsumerGroup下的Consumer实例订阅的Topic不同(3.x、4.x SDK适用)
+### 3.1 In the same ConsumerGroup, the Consumer instances have different
Topics subscribed to (applicable to 3.x, 4.x SDK)
-在早期3.x/4.x 版本的SDK中,如下图所示,同一 ConsumerGroup
下的三个Consumer实例C1、C2和C3分别订阅了TopicA、TopicB和TopicC,订阅的Topic不一致,不符合订阅关系一致性原则。
+In the early 3.x/4.x versions of the SDK, as shown in the following figure,
three Consumer instances C1, C2, and C3 in the same ConsumerGroup have
subscribed to TopicA, TopicB, and TopicC respectively, and their subscribed
Topics are inconsistent, which does not conform to the principle of consistent
subscription.
:::note
-5.x版本SDK 已经支持同一个 ConsumerGroup 下的Consumer实例订阅不同的Topic。
+The 5.x version of the SDK now supports Consumer instances in the same
ConsumerGroup subscribing to different topics.
:::

-### 3.2 同一 ConsumerGroup 下的 Consumer 实例订阅的Topic相同,但订阅的Tag不一致
+### 3.2 Consumer instances in the same ConsumerGroup subscribe to the same
topic, but the subscribed tags are different.
-如下图所示,同一 ConsumerGroup
下的三个Consumer实例C1、C2和C3分别都订阅了TopicA,但是C1订阅TopicA的Tag为**Tag1**,C2和C3订阅的TopicA的Tag为**Tag2**,订阅同一Topic的Tag不一致,不符合订阅关系一致性原则。
+As shown in the following figure, the Consumer instances C1, C2, and C3 in the
same ConsumerGroup all subscribe to TopicA, but C1 subscribes to Tag1 of
TopicA, while C2 and C3 subscribe to Tag2 of TopicA. The subscribed tags of the
same topic are inconsistent and do not conform to the consistency principle of
subscription relationship.

-**错误示例代码二**
+**Error example code 2:**
-+ Consumer实例2-1:
++ Consumer example 2-1:
```java
- PushConsumer consumer1 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
- consumer1.subscribe("TopicA", new FilterExpression("Tag1",
FilterExpressionType.TAG));
+ PushConsumer consumer1 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
+ consumer1.subscribe("TopicA", new FilterExpression("Tag1",
FilterExpressionType.TAG));
```
-+ Consumer实例2-2:
++ Consumer example 2-2:
```java
- PushConsumer consumer2 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
- consumer2.subscribe("TopicA", new FilterExpression("Tag2",
FilterExpressionType.TAG));
+ PushConsumer consumer2 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
+ consumer2.subscribe("TopicA", new FilterExpression("Tag2",
FilterExpressionType.TAG));
```
-+ Consumer实例2-3:
++ Consumer example 2-3:
```java
- PushConsumer consumer3 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
- consumer3.subscribe("TopicA", new FilterExpression("Tag2",
FilterExpressionType.TAG));
+ PushConsumer consumer3 =
provider.newPushConsumerBuilder().setConsumerGroup("GroupA").build();
+ consumer3.subscribe("TopicA", new FilterExpression("Tag2",
FilterExpressionType.TAG));
```
-
-
-
-
-