Open frlzk opened 2 years ago
Please assign to me
@zkzlx I am sorry I have no time to finish it now, I give up it.
@zkzlx , @HHoflittlefish777 , @steverao,
I have this issue reproduced in spring-cloud-starter-stream-rocketmq:2.2.7.RELEASE and 2.2.9.Release. This issue is due to below piece of code in com.alibaba.cloud.stream.binder.rocketmq.integration.outbound.RocketMQProduceFactory.initRocketMQProducer()
:
if (RocketMQProducerProperties.ProducerType.Trans
.equalsName(producerProperties.getProducerType())) {
......
}
else {
producer = new DefaultMQProducer(producerProperties.getNamespace(),
producerProperties.getGroup(), rpcHook,
producerProperties.getEnableMsgTrace(),
producerProperties.getCustomizedTraceTopic());
}
In initRocketMQProducer()
, the RocketMQ Producer be created by newing a DefaultMQProducer
. When some code change cause StreamBridge.send()
rerun, the DefaultMQProducer will be new again, which has already been created. So, the Exception raised inside of DefaultMQProducer()
.
In the current code branch 2.2.x which version now is 2.2.10-RC1
, I found this commit https://github.com/alibaba/spring-cloud-alibaba/commit/5e80d7c2c4e048f9eda6a624dadaf5c15c8c6e76 which already replaced the issue code by new ReusableMQProducer(...)
. The ReusableMQProducer()
avoids the RocketMQ Producer be created twice. Finally, I tested it with devtools and the Exception does not occur.
So, I believe this issue has been fixed in 2.2.10-RC1.
Thanks.
JiaJun
Which Component spring-cloud-starter-stream-rocketmq
Describe the bug When hot deployment in eclipse throw MQClientException: The producer group[mygroup] has been created before
To Reproduce Steps to reproduce the behavior:
Expected behavior Not throw exception and send message successfully.
Screenshots
Additional context Linux 、Java8 、spring-cloud-starter-stream-rocketmq:2.2.7.RELEASE 、spring-cloud-stream:3.1.2
Reason Not call MQClientInstance.unregisterProducer when stop application.