Technical work, should be praised and then see, form a habitCopy the code

RocketMQ use tutorial related series of directories


Source code description

MessageExt is located under this package:

package org.apache.rocketmq.common.message;
Copy the code

MessageExt source code analysis

Parameter description is in the code

public class MessageExt extends Message { private static final long serialVersionUID = 5720810158625748049L; MessageQueue private int queueId; MessageQueue private int queueId; // Record the size of messages stored in the Broker private int storeSize; // The offset recorded in ConsumeQueue private long queueOffset; MessageSysFlag specifies the system flag private int sysFlag; MessageSysFlag specifies the system flag. Private Long bornTimestamp is set when Producer sends messages. // Record the producer address that sends the message private SocketAddress bornHost; Private long storeTimestamp; Private SocketAddress storeHost; // Message Id private String msgId; // Store offset private long commitLogOffset on the Broker; // Message content CRC check value private int bodyCRC; Private int reconsumeTimes; private int reconsumeTimes; / / this parameter is not understand, know the bosses share under private long preparedTransactionOffset; Public String toString() {return "MessageExt [queueId=" + queueId + ", storeSize=" + storeSize + ", queueOffset=" + queueOffset + ", sysFlag=" + sysFlag + ", bornTimestamp=" + bornTimestamp + ", bornHost=" + bornHost + ", storeTimestamp=" + storeTimestamp + ", storeHost=" + storeHost + ", msgId=" + msgId + ", commitLogOffset=" + commitLogOffset + ", bodyCRC=" + bodyCRC + ", reconsumeTimes=" + reconsumeTimes + ", preparedTransactionOffset=" + preparedTransactionOffset + ", toString()=" + super.toString() + "]"; }}Copy the code

Inherited from Message, Message source parsing

public class Message implements Serializable { private static final long serialVersionUID = 8445773977080406428L; // topic private String topic; // private int flag; /** *MIN_OFFSET: minimum offset * MAX_OFFSET: maximum offset * CONSUME_START_TIME: consumption pull time *UNIQ_KEY: * CLUSTER: CLUSTER * WAIT: * TAGS: message TAGS *DELAY: **/ private Map<String, String> properties; //Producer Sends the actual message content, which is stored as a byte array (ASCII code). Message has a size limit. private byte[] body; Private String transactionId; Public int getDelayTimeLevel() {String t = this.getProperty(messageconst.property_delay_time_level); if (t ! = null) { return Integer.parseInt(t); } return 0; } public void setDelayTimeLevel(int level) {this.putProperty(messageconst.property_delay_time_level, messageconst.property_delay_time_level, String.valueOf(level)); } // omit get set @override public String toString() {return "Message{" topic='" + topic + '\' + ", flag=" + flag + ", properties=" + properties + ", body=" + Arrays.toString(body) + ", transactionId='" + transactionId + '\'' + '}'; }}Copy the code

Have some toxic chicken soup

Read some source code every day, a small step forward, a big step up.