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

[ISSUE #632 ] Fix NPE caused by using @ ExtRocketMQTemplateConfiguration annotation extension to send messages in v5 #639

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

lilinjiang
Copy link
Contributor

What is the purpose of the change

fix and close [ISSUE #632 ]

fix v5 client [ISSUE #632 ]

Brief changelog

问题现象:
修复应用启动时,监听RocketMQ消息后使用@ExtRocketMQTemplateConfiguration注解扩展的RocketMQTemplate发送消息导致的空指针异常问题。
问题原因:
Listener 启动时机比 @ExtRocketMQTemplateConfiguration注解扩展的RocketMQTemplate中producer 实例化的早,导致Listener监听到消息时 RocketMQTemplate中producerBuilder 还未实例化,使用RocketMQTemplate 发送消息将调用 getProducer() 方法获取 producer [ this.producer = producerBuilder.build() ],此时producerBuilder 等于null 将导致空指针异常。

(@RocketMQMessageListener 与 Spring Cloud Stream 的生产者一起使用时同样存在一样的问题,都是因为Listener的启动时机太早)
解决方案:
推迟了Listener 的启动时机 详情见commits。

@lilinjiang lilinjiang changed the title fix and close [ISSUE #632 ] [ISSUE #632 ] (V5 版本)修复使用@ExtRocketMQTemplateConfiguration注解扩展的RocketMQTemplate发送消息导致的空指针异常问题。 Mar 1, 2024
@lilinjiang
Copy link
Contributor Author

@panzhi33 修复了 v5 client

@RongtongJin RongtongJin changed the title [ISSUE #632 ] (V5 版本)修复使用@ExtRocketMQTemplateConfiguration注解扩展的RocketMQTemplate发送消息导致的空指针异常问题。 [ISSUE #632 ] Fix NPE caused by using @ ExtRocketMQTemplateConfiguration annotation extension to send messages in v5 Mar 3, 2024
@RongtongJin RongtongJin merged commit 37f25ab into apache:master Mar 4, 2024
3 checks passed
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