This is an automated email from the ASF dual-hosted git repository.
aaronai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new 3475874 Docs: complete the part about message identifier (#16)
3475874 is described below
commit 34758741fd6d6d905aae173744fcb29ea034a8a2
Author: Aaron Ai <[email protected]>
AuthorDate: Fri Jun 24 15:06:03 2022 +0800
Docs: complete the part about message identifier (#16)
---
docs/artwork/message_id.png | Bin 107463 -> 106718 bytes
docs/message_id.md | 18 +++++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/docs/artwork/message_id.png b/docs/artwork/message_id.png
index 058aed0..72b26fc 100644
Binary files a/docs/artwork/message_id.png and b/docs/artwork/message_id.png
differ
diff --git a/docs/message_id.md b/docs/message_id.md
index 89e7c1e..aa58cb7 100644
--- a/docs/message_id.md
+++ b/docs/message_id.md
@@ -6,8 +6,8 @@ Here is the new design for message identifier.
In the past, there are two types of implementation of message identifier.
-1. Message identifier based on the broker address and the offset in message
queue, find in
[MessageDecoder#createMessageId](https://github.com/apache/rocketmq/blob/release-4.9.3/common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java#L62-L71).
-2. Message identifier based on the client IP and unix timestamp, find in
[MessageClientIDSetter#createUniqID](https://github.com/apache/rocketmq/blob/release-4.9.3/common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java#L114-L131).
+1. Message identifier based on the broker address and the offset in message
queue, see
[MessageDecoder#createMessageId](https://github.com/apache/rocketmq/blob/release-4.9.3/common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java#L62-L71).
+2. Message identifier based on the client IP and unix timestamp, see
[MessageClientIDSetter#createUniqID](https://github.com/apache/rocketmq/blob/release-4.9.3/common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java#L114-L131).
The first type of message identifier is purely based on server-side
information, which makes each message stored on the broker absolutely unique.
The second message identifier is purely based on client information.
@@ -19,4 +19,16 @@ As for the second type, there are some major flaws in the
algorithm design. Firs
## Detailed Design
-
\ No newline at end of file
+
+
+This illustration shows an example of message identifier. The version number
of the newly designed version is 0x01, and number of all previous versions is
0x00. The message identifier's length is 17 bytes if its version is higher than
0x00, then we convert it to uppercase hexadecimal to get the message identifier
in string format.
+
+>**Note**: Big endian byte order is used to place data in message identifier.
+
+Take the message identifier in the figure as an example, it could be divided
into 5 parts:
+
+* **0x01**: fixed 1 byte for current version.
+* **0x56F7E71C361B**: lower 6 bytes of local mac address.
+* **0x21BC**: lower 2 bytes of process id.
+* **0x024CCDBE**: seconds since 2021-01-01 00:00:00(UTC+0, lower 4 bytes).
+* **0x00000000**: sequence number(4 bytes).