Skip to content

Commit

Permalink
fix(): delete sysytem proerty
Browse files Browse the repository at this point in the history
  • Loading branch information
panzhi33 committed Oct 30, 2024
1 parent b3963f7 commit 8a900c0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<String> SYSTEM_PROPERTY_SET = new HashSet<String>() {
{
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);
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 8a900c0

Please sign in to comment.