alibaba/spring-cloud-alibaba

Hot deployment stream-rocketmq MQClientException: The producer group[mygroup] has been created before

Open

#2390 opened on Feb 16, 2022

View on GitHub
 (3 comments) (0 reactions) (2 assignees)Java (29,106 stars) (8,513 forks)batch import
area/rocketmqcontribution welcomegood first issue

Description

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:

  1. Spring boot application with devtools in Eclipse
  2. Send message using org.springframework.cloud.stream.function.StreamBridge.send
  3. Modify any code trigger spring devtools hot deployment
  4. When send message using org.springframework.cloud.stream.function.StreamBridge.send,Then throw exception

Expected behavior Not throw exception and send message successfully.

Screenshots

streamBridge.send("mytopic-out-0","hello");
org.apache.rocketmq.client.exception.MQClientException: The producer group[mygroup] has been created before, specify another name please.
See http://rocketmq.apache.org/docs/faq/ for further details.
	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:195)
	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:175)
	at org.apache.rocketmq.client.producer.DefaultMQProducer.start(DefaultMQProducer.java:271)
	at com.alibaba.cloud.stream.binder.rocketmq.integration.outbound.RocketMQProducerMessageHandler.start(RocketMQProducerMessageHandler.java:112)
	at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:248)
	at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindProducer(AbstractMessageChannelBinder.java:91)
	at org.springframework.cloud.stream.binder.AbstractBinder.bindProducer(AbstractBinder.java:152)
	at org.springframework.cloud.stream.binding.BindingService.doBindProducer(BindingService.java:313)
	at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:282)
	at org.springframework.cloud.stream.function.StreamBridge.resolveDestination(StreamBridge.java:200)
	at org.springframework.cloud.stream.function.StreamBridge.send(StreamBridge.java:152)
	at org.springframework.cloud.stream.function.StreamBridge.send(StreamBridge.java:130)
	

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.

Contributor guide