Skip to content

Commit 2ea965a

Browse files
authored
Clarify -s flag usage and add offset reset verification (#11555)
Updated documentation for CLI tools to clarify the usage of the -s flag and added a section on verifying consumer offset reset.
1 parent 8c36598 commit 2ea965a

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎docs/en/CLITools.md‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,8 @@ Before introducing the mqadmin management tool, the following points need to be
873873
</tr>
874874
<tr height=57 style='height:43.0pt'>
875875
<td height=57 class=xl67 width=87 style='height:43.0pt;width:65pt'>-s</td>
876-
<td class=xl68 width=87 style='width:65pt'>Resets the offset corresponding to this timestamp in a format see -h, if you want to reset to maxOffset, the value is 'now'.</td>
876+
<td class=xl68 width=87 style='width:65pt'>Timestamp to look up. Use Unix epoch milliseconds, the date format shown by
877+
<code>-h</code>, or <code>now</code> to use the current time.</td>
877878
</tr>
878879
<tr height=188 style='height:141.0pt'>
879880
<td height=188 class=xl67 width=87 style='height:141.0pt;width:65pt'>-f</td>
@@ -887,6 +888,21 @@ Before introducing the mqadmin management tool, the following points need to be
887888

888889

889890

891+
### Verify a consumer offset reset
892+
893+
Use a dedicated test consumer group that has already consumed messages from the topic.
894+
Timestamp 0 is the Unix epoch. In this example it precedes the retained messages.
895+
Compare the per-queue consumer offsets before and after the reset.
896+
897+
```sh
898+
sh bin/mqadmin consumerProgress -n localhost:9876 -g ReplayTestGroup
899+
sh bin/mqadmin resetOffsetByTime -n localhost:9876 -g ReplayTestGroup -t ReplayTestTopic -s 0
900+
sh bin/mqadmin consumerProgress -n localhost:9876 -g ReplayTestGroup
901+
```
902+
903+
Check the returned consumer offset for each queue. The earliest retained offset can
904+
be greater than zero. Resetting offsets can cause messages to be processed again.
905+
890906
## 5 Consumer and Consumer Group related command instructions
891907

892908
####

0 commit comments

Comments
 (0)