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

It is not appropriate for the DefaultRocketMQListenerContainer to only process the messageExt without additional processing of the message #346

Closed
wbzj1110 opened this issue Feb 3, 2021 · 8 comments
Labels
discuss Discuss whether to support

Comments

@wbzj1110
Copy link
Contributor

wbzj1110 commented Feb 3, 2021

https://github.com/apache/rocketmq-spring/blob/master/rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/support/DefaultRocketMQListenerContainer.java#L459

image

大家使用@RocketmqListiner标签常用的对象是 String Message MessageExt
如果仅对MessageExt 处理 会导致部分使用 Message 的用户 无法收到 properties topic等信息 与 String 一样。
希望 截图部分 增加对Message的额外处理。MessageExt 转换为Message即可 。

@wbzj1110
Copy link
Contributor Author

wbzj1110 commented Feb 3, 2021

if (Objects.equals(messageType, MessageExt.class) || Objects.equals(messageType, Message.class)) {
return messageExt;
}
即可。。。

@wbzj1110
Copy link
Contributor Author

wbzj1110 commented Feb 3, 2021

当然如果用instanceof 可以忽略子类的判断。不过性能上不知道是否有区别。

@RongtongJin RongtongJin changed the title DefaultRocketMQListenerContainer 仅对MessageExt做了处理没有对Message做额外处理不太妥当 It is not appropriate for the DefaultRocketMQListenerContainer to only process the messageExt without additional processing of the message Feb 13, 2021
@RongtongJin RongtongJin added the discuss Discuss whether to support label Feb 13, 2021
@RongtongJin
Copy link
Contributor

Wiki最佳实践第7条中推荐使用的是messageExt,这可以包含所有原生的RocketMQ Message的信息。

不过增加对RocketMQ Message的额外处理确实能帮助到那些误用Message的用户,你能提交一个PR来改善这个问题吗?

@wbzj1110
Copy link
Contributor Author

好的!您稍等。

@wbzj1110
Copy link
Contributor Author

#349 您好 pr 提了。。烦请得空check一下。

还有 能问下,这个问题以外的,
1)、关于spring-boot-rocketmq 这个项目没有计划支持全链路吗?我们这边对全链路做了补全。以切面的方式使用brave支持的。以独立jar包引入。。类似于打补丁了。
2)、关于@async标签,其实底层用rocketmq 实现比放入线程池的方式好不少。
我们这边也有实现,但是发现貌似都不太适合提到这个项目中,不知道有咩有计划开一个类似于rocketmq 的externals 的玩法,把大家的研发过程 搞出来的内部使用,同时纯技术方面对rocketmq 生态使用有一定帮助的积累一下?

@wbzj1110
Copy link
Contributor Author

关于对 message这部分信息没有补上去,我们这就是在对rocketmq全链路补全的部分,发现一部分研发再使用Message的全链路没有拿到,所以才发现的这个问题,觉得可能加上会好一些,所以才提的这个issue。

@RongtongJin
Copy link
Contributor

#349 您好 pr 提了。。烦请得空check一下。

还有 能问下,这个问题以外的,
1)、关于spring-boot-rocketmq 这个项目没有计划支持全链路吗?我们这边对全链路做了补全。以切面的方式使用brave支持的。以独立jar包引入。。类似于打补丁了。
2)、关于@async标签,其实底层用rocketmq 实现比放入线程池的方式好不少。
我们这边也有实现,但是发现貌似都不太适合提到这个项目中,不知道有咩有计划开一个类似于rocketmq 的externals 的玩法,把大家的研发过程 搞出来的内部使用,同时纯技术方面对rocketmq 生态使用有一定帮助的积累一下?

已经合并。RocketMQ有一个externals的仓库存放了一些未孵化的项目,是否合适放入该仓库? 这里的全链路指的是做了指标的监控和暴露吗?

@wbzj1110
Copy link
Contributor Author

#349 您好 pr 提了。。烦请得空check一下。
还有 能问下,这个问题以外的,
1)、关于spring-boot-rocketmq 这个项目没有计划支持全链路吗?我们这边对全链路做了补全。以切面的方式使用brave支持的。以独立jar包引入。。类似于打补丁了。
2)、关于@async标签,其实底层用rocketmq 实现比放入线程池的方式好不少。
我们这边也有实现,但是发现貌似都不太适合提到这个项目中,不知道有咩有计划开一个类似于rocketmq 的externals 的玩法,把大家的研发过程 搞出来的内部使用,同时纯技术方面对rocketmq 生态使用有一定帮助的积累一下?

已经合并。RocketMQ有一个externals的仓库存放了一些未孵化的项目,是否合适放入该仓库? 这里的全链路指的是做了指标的监控和暴露吗?

指标的监控与暴露与spring-boot的zipkin那套已经有了。只不过由于rocketmq没有补全,导致全链路断开了。
我举个例子,拿spring-boot的feign,A服务通过feign调用B,feign会自动的获取A服务的当前traceId【唯一标记】,添加到头部,然后B服务会解析头部,如果有这个唯一标示,那么会自动使用这个traceId。
表现为:
1)、拿着此traceId,可以直接去zipkin-server查询整个链路以及耗时情况
2)、拿着此traceId,如果log日志格式定义支持traceId打印,直接在kibana搜索出整个服务的日志。跨N个链路的情况下会非常方便。
image

把http替换为mq其实是类似的。kafka是支持这个功能的,这部分是需要社区来补充的。rocketmq 我这边作为一个基于此使用的,直接内部fix社区代码,然后内部使用,不太方便跟着社区后续的更新,所以初步采用的是切面方式做的补充,等于是打补丁了。其实spring-boot-rocketmq-starter项目直接支持全链路肯定是更好地。

image

感谢您的回复。还有@async标签这个功能,我与公司内部的技术老大与法规部沟通下,争取上传到 rocketmq的https://github.com/apache/rocketmq-externals 上。 我一开始以为是rocketmq的直接扩展,然后我这边大部分都要围绕着spring-boot与rocketmq结合与以后的玩法,嘿嘿想多了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Discuss whether to support
Projects
None yet
Development

No branches or pull requests

2 participants