Skip to content

[Bug] MessageBatch Custom Attribute Value Lost #9195

Open
@Sunw730

Description

@Sunw730

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

生产端:Windows11
消费端:Windows11
服务端:CentOS Linux 7 (Core)

RocketMQ version

生产端/消费端:org.apache.rocketmq:rocketmq-client:4.7.1
服务端:rocketmq server 4.7.1

JDK Version

OpenJDK:zulu-11

Describe the Bug

生产端发送批量消息 MessageBatch 时,通过 putUserProperty 方法设置了属性值(内部的 List 都设置了相同的属性值),
消费端接收到的消息中没有获取到自定义的属性值。

Steps to Reproduce

  1. 生产端:
// step 1
messageBatch.putUserProperty("name", "value");
messageBatch.forEach(message -> message.putUserProperty("name", "value"));
producer.send(messageBatch);
  1. 消费端:
consumer.registerMessageListener((MessageListenerConcurrently) (messages, context) -> {
    messages.forEach(message -> {
        // step 2
        System.out.println(message.getUserProperty("name"));
    });
});

What Did You Expect to See?

我希望 step 2 能输出字符串 value

What Did You See Instead?

目前 step 2 处实际输出的是 null

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions