Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] MessageBatch Custom Attribute Value Lost #9195

Open
3 tasks done
Sunw730 opened this issue Feb 20, 2025 · 2 comments
Open
3 tasks done

[Bug] MessageBatch Custom Attribute Value Lost #9195

Sunw730 opened this issue Feb 20, 2025 · 2 comments

Comments

@Sunw730
Copy link

Sunw730 commented Feb 20, 2025

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

@yx9o
Copy link
Contributor

yx9o commented Feb 21, 2025

嗨,我没有复现你说的场景,方便发下完整的生产消费代码吗?或者你可以调试下,确认下发送时props里是否包含设置的属性。

@RongtongJin
Copy link
Contributor

这个好像有修复,你可以用最新的5.x或者4.x版本试试吗?

@RongtongJin RongtongJin changed the title [Bug] MessageBatch 自定义属性值丢失问题 [Bug] MessageBatch Custom Attribute Value Lost Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants