From 8a900c05021c14359d32a5b201dc6f6207966a15 Mon Sep 17 00:00:00 2001 From: panzhi33 Date: Wed, 30 Oct 2024 10:31:50 +0800 Subject: [PATCH 1/2] fix(): delete sysytem proerty --- .../client/support/RocketMQHeaders.java | 21 +++++++++++++++++++ .../rocketmq/client/support/RocketMQUtil.java | 9 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) 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(); } From caff42b069c2e57833e56261e9dde20612ace5e9 Mon Sep 17 00:00:00 2001 From: panzhi33 Date: Mon, 16 Dec 2024 14:14:53 +0800 Subject: [PATCH 2/2] fix(): delete sysytem proerty --- .../org/apache/rocketmq/client/support/RocketMQUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 1b8fb06f..81f873d6 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 @@ -87,11 +87,11 @@ 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) -> - { - if (!RocketMQHeaders.SYSTEM_PROPERTY_SET.contains(key)) { - builder.addProperty(key, String.valueOf(value)); - } + { + if (!RocketMQHeaders.SYSTEM_PROPERTY_SET.contains(key)) { + builder.addProperty(key, String.valueOf(value)); } + } ); }