You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2022/09/29 06:20:39 UTC

[rocketmq-site] branch new-official-website updated: [ISSUE #228] Polish up document command formate (#229)

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

duhengforever 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 5be96ad3 [ISSUE #228] Polish up document command formate (#229)
5be96ad3 is described below

commit 5be96ad3c9c8ea320950ce003c3f8a662d09d2ce
Author: mxsm <lj...@gmail.com>
AuthorDate: Thu Sep 29 14:20:35 2022 +0800

    [ISSUE #228] Polish up document command formate (#229)
---
 .../12push.md"                                     | 14 ++++---
 .../18Exporter.md"                                 |  1 +
 .../15bestpractice.md"                             | 32 +++++++++-------
 .../18access.md"                                   | 23 +++++++----
 .../21subscribe.md"                                | 44 +++++++++++-----------
 .../01-\344\273\213\347\273\215/02quickstart.md"   | 18 ++++-----
 .../05message1.md"                                 |  2 +-
 .../06message2.md"                                 |  2 +-
 8 files changed, 76 insertions(+), 60 deletions(-)

diff --git "a/docs/03-\346\266\210\350\264\271\350\200\205/12push.md" "b/docs/03-\346\266\210\350\264\271\350\200\205/12push.md"
index 8372dcaa..5ce15c5d 100644
--- "a/docs/03-\346\266\210\350\264\271\350\200\205/12push.md"
+++ "b/docs/03-\346\266\210\350\264\271\350\200\205/12push.md"
@@ -198,13 +198,15 @@ consumer.subscribe("SqlFilterTest",
 若Consumer消费某条消息失败,则RocketMQ会在重试间隔时间后,将消息重新投递给Consumer消费,若达到最大重试次数后消息还没有成功被消费,则消息将被投递至死信队列
 >消息重试只针对集群消费模式生效;广播消费模式不提供失败重试特性,即消费失败后,失败消息不再重试,继续消费新的消息
 - 最大重试次数:消息消费失败后,可被重复投递的最大次数。
-```java
-consumer.setMaxReconsumeTimes(10);
-```
+
+  ```java
+  consumer.setMaxReconsumeTimes(10);
+  ```
 - 重试间隔:消息消费失败后再次被投递给Consumer消费的间隔时间,只在顺序消费中起作用。
-```java
-consumer.setSuspendCurrentQueueTimeMillis(5000);
-```
+
+  ```java
+  consumer.setSuspendCurrentQueueTimeMillis(5000);
+  ```
 
 顺序消费和并发消费的重试机制并不相同,顺序消费消费失败后会先在客户端本地重试直到最大重试次数,这样可以避免消费失败的消息被跳过,消费下一条消息而打乱顺序消费的顺序,而并发消费消费失败后会将消费失败的消息重新投递回服务端,再等待服务端重新投递回来,在这期间会正常消费队列后面的消息。
 >并发消费失败后并不是投递回原Topic,而是投递到一个特殊Topic,其命名为%RETRY%ConsumerGroupName,集群模式下并发消费每一个ConsumerGroup会对应一个特殊Topic,并会订阅该Topic。
diff --git "a/docs/04-\351\203\250\347\275\262\344\270\216\350\277\220\347\273\264/18Exporter.md" "b/docs/04-\351\203\250\347\275\262\344\270\216\350\277\220\347\273\264/18Exporter.md"
index dc83596a..40320841 100644
--- "a/docs/04-\351\203\250\347\275\262\344\270\216\350\277\220\347\273\264/18Exporter.md"
+++ "b/docs/04-\351\203\250\347\275\262\344\270\216\350\277\220\347\273\264/18Exporter.md"
@@ -65,6 +65,7 @@ MetricCollectTask 类中有 5 个定时任务,分别为 collectTopicOffset、c
 
 
 ```java
+   ```java
     TopicList topicList = null;
     try {  topicList = mqAdminExt.fetchAllTopicList();
 } catch (Exception ex) {
diff --git "a/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/15bestpractice.md" "b/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/15bestpractice.md"
index 58afe6a5..f2205fc7 100644
--- "a/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/15bestpractice.md"
+++ "b/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/15bestpractice.md"
@@ -71,28 +71,32 @@ RocketMQ可以令客户端找到Name Server, 然后通过Name Server再找到Bro
 
 - 代码中指定Name Server地址,多个namesrv地址之间用分号分割   
 
-```java
-producer.setNamesrvAddr("192.168.0.1:9876;192.168.0.2:9876");  
+  ```java
+  producer.setNamesrvAddr("192.168.0.1:9876;192.168.0.2:9876");  
+  
+  consumer.setNamesrvAddr("192.168.0.1:9876;192.168.0.2:9876");
+  ```
 
-consumer.setNamesrvAddr("192.168.0.1:9876;192.168.0.2:9876");
-```
 - Java启动参数中指定Name Server地址
 
-```text
--Drocketmq.namesrv.addr=192.168.0.1:9876;192.168.0.2:9876  
-```
+  ```text
+  -Drocketmq.namesrv.addr=192.168.0.1:9876;192.168.0.2:9876  
+  ```
+
 - 环境变量指定Name Server地址
 
-```text
-export   NAMESRV_ADDR=192.168.0.1:9876;192.168.0.2:9876   
-```
+  ```text
+  export   NAMESRV_ADDR=192.168.0.1:9876;192.168.0.2:9876
+  ```
+
 - HTTP静态服务器寻址(默认)
 
-客户端启动后,会定时访问一个静态HTTP服务器,地址如下:<http://jmenv.tbsite.net:8080/rocketmq/nsaddr>,这个URL的返回内容如下:
+  客户端启动后,会定时访问一个静态HTTP服务器,地址如下:<http://jmenv.tbsite.net:8080/rocketmq/nsaddr>,这个URL的返回内容如下:
+
+  ```text
+  192.168.0.1:9876;192.168.0.2:9876
+  ```
 
-```text
-192.168.0.1:9876;192.168.0.2:9876   
-```
 客户端默认每隔2分钟访问一次这个HTTP服务器,并更新本地的Name Server地址。URL已经在代码中硬编码,可通过修改/etc/hosts文件来改变要访问的服务器,例如在/etc/hosts增加如下配置:
 ```text
 10.232.22.67    jmenv.taobao.net   
diff --git "a/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/18access.md" "b/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/18access.md"
index 09906025..cf7614ce 100644
--- "a/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/18access.md"
+++ "b/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/18access.md"
@@ -33,7 +33,7 @@ ACL客户端可以参考:**org.apache.rocketmq.example.simple**包下面的**A
 
 ## 3. 支持权限控制的集群部署
 在**distribution/conf/plain_acl.yml**配置文件中按照上述说明定义好权限属性后,打开**aclEnable**开关变量即可开启RocketMQ集群的ACL特性。这里贴出Broker端开启ACL特性的properties配置文件内容:
-```
+```properties
 brokerClusterName=DefaultCluster
 brokerName=broker-a
 brokerId=0
@@ -86,8 +86,9 @@ RocketMQ的权限控制存储的默认实现是基于yml配置文件。用户可
 
 该命令的示例如下:
 
-sh mqadmin updateAclConfig -n 192.168.1.2:9876 -b 192.168.12.134:10911 -a RocketMQ -s 1234567809123 
--t topicA=DENY,topicD=SUB -g groupD=DENY,groupB=SUB
+```shell
+$ sh mqadmin updateAclConfig -n 192.168.1.2:9876 -b 192.168.12.134:10911 -a RocketMQ -s 1234567809123 -t topicA=DENY,topicD=SUB -g groupD=DENY,groupB=SUB
+```
 
 说明:如果不存在则会在ACL Config YAML配置文件中创建;若存在,则会更新对应的“accounts”的属性值;
 如果指定的是集群名称,则会在集群中各个broker节点执行该命令;否则会在单个broker节点执行该命令。
@@ -109,7 +110,9 @@ sh mqadmin updateAclConfig -n 192.168.1.2:9876 -b 192.168.12.134:10911 -a Rocket
 ### 7.2 删除ACL配置文件里面的对应“account”
 该命令的示例如下:
 
-sh mqadmin deleteAccessConfig -n 192.168.1.2:9876 -c DefaultCluster -a RocketMQ
+```shell
+$ sh mqadmin deleteAccessConfig -n 192.168.1.2:9876 -c DefaultCluster -a RocketMQ
+```
 
 说明:如果指定的是集群名称,则会在集群中各个broker节点执行该命令;否则会在单个broker节点执行该命令。
 其中,参数"a"为Access Key的值,用以标识唯一账户id,因此该命令的参数中指定账户id即可。
@@ -125,7 +128,9 @@ sh mqadmin deleteAccessConfig -n 192.168.1.2:9876 -c DefaultCluster -a RocketMQ
 ### 7.3 更新ACL配置文件里面中的全局白名单
 该命令的示例如下:
 
-sh mqadmin updateGlobalWhiteAddr -n 192.168.1.2:9876 -b 192.168.12.134:10911 -g 10.10.154.1,10.10.154.2
+```shell
+$ sh mqadmin updateGlobalWhiteAddr -n 192.168.1.2:9876 -b 192.168.12.134:10911 -g 10.10.154.1,10.10.154.2
+```
 
 说明:如果指定的是集群名称,则会在集群中各个broker节点执行该命令;否则会在单个broker节点执行该命令。
 其中,参数"g"为全局IP白名的值,用以更新ACL配置文件中的“globalWhiteRemoteAddresses”字段的属性值。
@@ -140,7 +145,9 @@ sh mqadmin updateGlobalWhiteAddr -n 192.168.1.2:9876 -b 192.168.12.134:10911 -g
 ### 7.4 查询集群/Broker的ACL配置文件版本信息
 该命令的示例如下:
 
-sh mqadmin clusterAclConfigVersion -n 192.168.1.2:9876 -c DefaultCluster
+```shell
+$ sh mqadmin clusterAclConfigVersion -n 192.168.1.2:9876 -c DefaultCluster
+```
 
 说明:如果指定的是集群名称,则会在集群中各个broker节点执行该命令;否则会在单个broker节点执行该命令。
 
@@ -153,7 +160,9 @@ sh mqadmin clusterAclConfigVersion -n 192.168.1.2:9876 -c DefaultCluster
 ### 7.5 查询集群/Broker的ACL配置文件全部内容
 该命令的示例如下:
 
-sh mqadmin getAccessConfigSubCommand -n 192.168.1.2:9876 -c DefaultCluster
+```shell
+$ sh mqadmin getAccessConfigSubCommand -n 192.168.1.2:9876 -c DefaultCluster
+```
 
 说明:如果指定的是集群名称,则会在集群中各个broker节点执行该命令;否则会在单个broker节点执行该命令。
 
diff --git "a/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/21subscribe.md" "b/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/21subscribe.md"
index b7cb1feb..8c6815b4 100644
--- "a/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/21subscribe.md"
+++ "b/docs/05-\346\234\200\344\275\263\345\256\236\350\267\265/21subscribe.md"
@@ -131,31 +131,31 @@ C1、C2、C3的订阅关系一致,即C1、C2、C3订阅消息的代码必须
 
 + Consumer实例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:
 
-```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不一致
 
diff --git "a/i18n/en/docusaurus-plugin-content-docs/current/01-\344\273\213\347\273\215/02quickstart.md" "b/i18n/en/docusaurus-plugin-content-docs/current/01-\344\273\213\347\273\215/02quickstart.md"
index d1e88bf5..455e1e92 100644
--- "a/i18n/en/docusaurus-plugin-content-docs/current/01-\344\273\213\347\273\215/02quickstart.md"
+++ "b/i18n/en/docusaurus-plugin-content-docs/current/01-\344\273\213\347\273\215/02quickstart.md"
@@ -22,10 +22,10 @@ The following instruction takes the application of RocketMQ 4.9.4 source package
 Extract the source package of RocketMQ 4.9.4, then compile and build the binary executables:
 
 ```shell
-  > unzip rocketmq-all-4.9.4-source-release.zip
-  > cd rocketmq-all-4.9.4-source-release/
-  > mvn -Prelease-all -DskipTests clean install -U
-  > cd distribution/target/rocketmq-4.9.4/rocketmq-4.9.4
+$ unzip rocketmq-all-4.9.4-source-release.zip
+$ cd rocketmq-all-4.9.4-source-release/
+$ mvn -Prelease-all -DskipTests clean install -U
+$ cd distribution/target/rocketmq-4.9.4/rocketmq-4.9.4
 ```
 
 ## 2. Start the NameServer
@@ -77,11 +77,11 @@ Thus far, a single-Master RocketMQ cluster has been deployed, and we are able to
 Before sending and receiving messages, the clients need to identify the address of the NameServer. RocketMQ has multiple ways to set the NameServer address on the client side. One of them is to modify the environment variable `NAMESRV_ADDR` :
 
 ``` shell
- > export NAMESRV_ADDR=localhost:9876
- > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
+$ export NAMESRV_ADDR=localhost:9876
+$ sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
  SendResult [sendStatus=SEND_OK, msgId= ...
 
- > sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
+$ sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
  ConsumeMessageThread_%d Receive New Messages: [MessageExt...
 ```
 
@@ -90,11 +90,11 @@ Before sending and receiving messages, the clients need to identify the address
 After finishing the practice, we could shut down the service by the following commands:
 
 ```shell
-> sh bin/mqshutdown broker
+$ sh bin/mqshutdown broker
 The mqbroker(36695) is running...
 Send shutdown request to mqbroker(36695) OK
 
-> sh bin/mqshutdown namesrv
+$ sh bin/mqshutdown namesrv
 The mqnamesrv(36664) is running...
 Send shutdown request to mqnamesrv(36664) OK
 ```
\ No newline at end of file
diff --git "a/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/05message1.md" "b/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/05message1.md"
index 0551a949..6c3ec354 100644
--- "a/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/05message1.md"
+++ "b/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/05message1.md"
@@ -5,7 +5,7 @@
 RocketMQ cluster is enabled by default with **autoCreateTopicEnable** configuration, which will automatically create Topics for the sent messages. If autoCreateTopicEnable is not enabled, you can also use the RocketMQ Admin tool to create the target Topic.
 
 ```shell
-> sh bin/mqadmin updateTopic -c DefaultCluster -t TopicTest -n 127.0.0.1:9876
+$ sh bin/mqadmin updateTopic -c DefaultCluster -t TopicTest -n 127.0.0.1:9876
 create topic to 127.0.0.1:10911 success.
 TopicConfig [topicName=TopicTest, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=false, attributes=null]
 ```
diff --git "a/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/06message2.md" "b/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/06message2.md"
index fe9f88a3..74046640 100644
--- "a/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/06message2.md"
+++ "b/i18n/en/docusaurus-plugin-content-docs/current/02-\347\224\237\344\272\247\350\200\205/06message2.md"
@@ -67,7 +67,7 @@ If a Broker drops out, does the total number of queues change at that point?
 If a change occurs, messages with the same ShardingKey will be sent to a different queue causing disorder. If no change occurs, messages will be sent to the queue of the offline Broker, which is bound to fail. Therefore, Apache RocketMQ provides two modes, to guarantee strict order over availability, create Topic by specifying the ```-o``` parameter (--order) to be true, which represents ordered messages:
 
 ```shell {1}
-> sh bin/mqadmin updateTopic -c DefaultCluster -t TopicTest -o true -n 127.0.0.1:9876
+$ sh bin/mqadmin updateTopic -c DefaultCluster -t TopicTest -o true -n 127.0.0.1:9876
 create topic to 127.0.0.1:10911 success.
 TopicConfig [topicName=TopicTest, readQueueNums=8, writeQueueNums=8, perm=RW-, topicFilterType=SINGLE_TAG, topicSysFlag=0, order=true, attributes=null]
 ```