diff --git a/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQHeaders.java b/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQHeaders.java index 9d0145ca..e4ab86fe 100644 --- a/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQHeaders.java +++ b/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQHeaders.java @@ -16,6 +16,9 @@ */ package org.apache.rocketmq.client.support; +import java.util.HashSet; +import java.util.Set; + public class RocketMQHeaders { public static final String PREFIX = "rocketmq_"; public static final String KEYS = "KEYS"; @@ -30,4 +33,22 @@ public class RocketMQHeaders { public static final String TRANSACTION_ID = "TRANSACTION_ID"; public static final String DELAY = "DELAY"; public static final String WAIT = "WAIT"; + + public static final Set SYSTEM_PROPERTY_SET = new HashSet() { + { + add(KEYS); + add(TAGS); + add(KEYS); + add(TOPIC); + add(MESSAGE_ID); + add(BORN_TIMESTAMP); + add(BORN_HOST); + add(FLAG); + add(QUEUE_ID); + add(SYS_FLAG); + add(TRANSACTION_ID); + add(DELAY); + add(WAIT); + } + }; } diff --git a/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQUtil.java b/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQUtil.java index 4e95bf46..1b8fb06f 100644 --- a/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQUtil.java +++ b/rocketmq-v5-client-spring-boot/src/main/java/org/apache/rocketmq/client/support/RocketMQUtil.java @@ -86,7 +86,14 @@ public static org.apache.rocketmq.client.apis.message.Message getAndWrapMessage( } messageBuilder.setBody(payloads); org.apache.rocketmq.client.apis.message.MessageBuilder builder = messageBuilder; - headers.forEach((key, value) -> builder.addProperty(key, String.valueOf(value))); + headers.forEach((key, value) -> + { + if (!RocketMQHeaders.SYSTEM_PROPERTY_SET.contains(key)) { + builder.addProperty(key, String.valueOf(value)); + } + } + + ); } return messageBuilder.build(); }