You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/01/29 18:06:49 UTC

[GitHub] [rocketmq-spring] liuliuzo opened a new issue #127: Support Thrid part SDK DefaultMQProducer bean

liuliuzo opened a new issue #127:
URL: https://github.com/apache/rocketmq-spring/issues/127


   重新描述下这个问题,事情是这样的,我这里遇到一个特殊的场景,在使用rocketmq-spring时引入了一个外部的SDK jar包这个包自己使用了原生的初始化了DefaultMQProducer 并且在spring容器里,导致报错:Caused by: org.apache.rocketmq.client.exception.MQClientException: The producer service state not OK, maybe started once, RUNNING
   
   ```
   @Configuration
   public class Config {
       @Bean
       public DefaultMQProducer defaultMQProducer() {
           DefaultMQProducer producer = new DefaultMQProducer("please_rename_unique_group_name");
           try {
               producer.start();
           } catch (MQClientException e) {
               e.printStackTrace();
           }
           return producer;
       }
   }
   ```
   大致原因是三方的SDK里自己注入了DefaultMQProducer的spring bean并且start了客户端。 能否给default producer 设置一个独有的instanceName屏蔽这个问题?
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org