This is an automated email from the ASF dual-hosted git repository. zhouxzhan pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push: new dc3f22ffe9 add getter for class Message ,fix json serialize bug (#7439) dc3f22ffe9 is described below commit dc3f22ffe9eb83ace991b68921076093c7c0da5f Author: LetLetMe <43874697+letle...@users.noreply.github.com> AuthorDate: Tue Oct 10 17:39:23 2023 +0800 add getter for class Message ,fix json serialize bug (#7439) Co-authored-by: LetLetMe <allen....@alibaba-inc.com> --- .../apache/rocketmq/common/message/Message.java | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/apache/rocketmq/common/message/Message.java b/common/src/main/java/org/apache/rocketmq/common/message/Message.java index e02b526a18..c7997c4731 100644 --- a/common/src/main/java/org/apache/rocketmq/common/message/Message.java +++ b/common/src/main/java/org/apache/rocketmq/common/message/Message.java @@ -218,14 +218,36 @@ public class Message implements Serializable { public void setDelayTimeSec(long sec) { this.putProperty(MessageConst.PROPERTY_TIMER_DELAY_SEC, String.valueOf(sec)); } + + public long getDelayTimeSec() { + String t = this.getProperty(MessageConst.PROPERTY_TIMER_DELAY_SEC); + if (t != null) { + return Long.parseLong(t); + } + return 0; + } + public void setDelayTimeMs(long timeMs) { this.putProperty(MessageConst.PROPERTY_TIMER_DELAY_MS, String.valueOf(timeMs)); } + + public long getDelayTimeMs() { + String t = this.getProperty(MessageConst.PROPERTY_TIMER_DELAY_MS); + if (t != null) { + return Long.parseLong(t); + } + return 0; + } + public void setDeliverTimeMs(long timeMs) { this.putProperty(MessageConst.PROPERTY_TIMER_DELIVER_MS, String.valueOf(timeMs)); } public long getDeliverTimeMs() { - return Long.parseLong(this.getUserProperty(MessageConst.PROPERTY_TIMER_DELIVER_MS)); + String t = this.getProperty(MessageConst.PROPERTY_TIMER_DELIVER_MS); + if (t != null) { + return Long.parseLong(t); + } + return 0; } }