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

fix:MessageBuilder.key()无效的问题 #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

a252937166
Copy link

@a252937166 a252937166 commented Jan 24, 2019

#16
1.使用MessageBuilder.of(msg).tag("").key("key").topic(topic).build(),是发现.key("key")无论怎么设置都无效。修复后改为了,如果有.key(),把它作为消息的key,如果实体中还有@MQKey@MQKey的内容拼接在其后面。
2.实体类中有多个@MQKey("key")时,只有最后一个字段的@MQKey("key")有效,感觉不是很好,改成了如果有多个@MQKey("key"),就把所有key的内容拼接到一起,成为消息的key。
3.为了不和之前版本混淆,版本改为了0.1.1
望及时采纳,发布到中央仓库。

@coveralls
Copy link

coveralls commented Jan 24, 2019

Coverage Status

Coverage increased (+0.1%) to 23.699% when pulling a690718 on a252937166:master into 564c26b on maihaoche:master.

@suclogger
Copy link
Member

我认为隐式的Key拼接方案并不合理,key是具体业务语义的体现,进行拼接后丢失了这一语义,应当让使用方显著感知到这个行为。能否重新考虑fix方式?

ouyangduning added 3 commits July 2, 2020 20:37
1.新增RocketMQTemplate,默认自动注入RocketMQTemplate,使用方式和AbstractMQProducer一致。大多场景,不需要多个@MQProducer,开发人员可以直接使用RocketMQTemplate发送消息。
2.取消了一个类中多个@MQKey的设计,@MQKey修改为(ElementType.TYPE),注解在类上而非字段上。使用方式@MQKey(field = "xxx"),field和字段名对应,Builder中存在.key()时,优先以builder为准
3.版本修改为0.1.2-SNAPSHOT
升级lombok版本,适应travis-ci验证
@a252937166
Copy link
Author

1.我目前修改为,@MQKey现在注解到类上,指定一个field的name,如果field指定错误则自动忽略。如果使用builder显示指定key时,以builder设定为准。
2.我使用过程中发现,大多是情况下,目前修改版本只需要一个producer发送消息。这种场景,显示地使用@MQProducer构建出一个producer其实没有必要。可以参考rabbitmq这样,自动注入一个RocketMQTemplate给使用者。当然@MQProducer目前还是保留的。

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

Successfully merging this pull request may close these issues.

3 participants