You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2018/04/24 03:10:24 UTC
[rocketmq] branch develop_oms_0.3.0 updated: Support scheduled
message
This is an automated email from the ASF dual-hosted git repository.
lizhanhui pushed a commit to branch develop_oms_0.3.0
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop_oms_0.3.0 by this push:
new de0be11 Support scheduled message
de0be11 is described below
commit de0be119f4116798c163b484efe4583464973507
Author: shutian.lzh <sh...@alibaba-inc.com>
AuthorDate: Tue Apr 24 11:10:12 2018 +0800
Support scheduled message
---
.../java/io/openmessaging/rocketmq/domain/RocketMQConstants.java | 7 +++++++
.../src/main/java/io/openmessaging/rocketmq/utils/OMSUtil.java | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/openmessaging/src/main/java/io/openmessaging/rocketmq/domain/RocketMQConstants.java b/openmessaging/src/main/java/io/openmessaging/rocketmq/domain/RocketMQConstants.java
new file mode 100644
index 0000000..838bbf5
--- /dev/null
+++ b/openmessaging/src/main/java/io/openmessaging/rocketmq/domain/RocketMQConstants.java
@@ -0,0 +1,7 @@
+package io.openmessaging.rocketmq.domain;
+
+public interface RocketMQConstants {
+
+ String STARTDELIVERTIME = "__STARTDELIVERTIME";
+
+}
diff --git a/openmessaging/src/main/java/io/openmessaging/rocketmq/utils/OMSUtil.java b/openmessaging/src/main/java/io/openmessaging/rocketmq/utils/OMSUtil.java
index 0938b83..36f0656 100644
--- a/openmessaging/src/main/java/io/openmessaging/rocketmq/utils/OMSUtil.java
+++ b/openmessaging/src/main/java/io/openmessaging/rocketmq/utils/OMSUtil.java
@@ -22,6 +22,7 @@ import io.openmessaging.Message.BuiltinKeys;
import io.openmessaging.OMS;
import io.openmessaging.producer.SendResult;
import io.openmessaging.rocketmq.domain.BytesMessageImpl;
+import io.openmessaging.rocketmq.domain.RocketMQConstants;
import io.openmessaging.rocketmq.domain.SendResultImpl;
import java.lang.reflect.Field;
import java.util.Iterator;
@@ -53,6 +54,13 @@ public class OMSUtil {
//All destinations in RocketMQ use Topic
rmqMessage.setTopic(sysHeaders.getString(BuiltinKeys.DESTINATION));
+ if (sysHeaders.containsKey(BuiltinKeys.START_TIME)) {
+ long deliverTime = sysHeaders.getLong(BuiltinKeys.START_TIME, 0);
+ if (deliverTime > 0) {
+ rmqMessage.putUserProperty(RocketMQConstants.STARTDELIVERTIME, String.valueOf(deliverTime));
+ }
+ }
+
for (String key : userHeaders.keySet()) {
MessageAccessor.putProperty(rmqMessage, key, userHeaders.getString(key));
}
--
To stop receiving notification emails like this one, please contact
lizhanhui@apache.org.