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 2020/06/01 05:32:18 UTC

[GitHub] [rocketmq] guohongtao0214 opened a new issue #2061: 同一个jvm启动多个生产者失败

guohongtao0214 opened a new issue #2061:
URL: https://github.com/apache/rocketmq/issues/2061


   Caused by: org.apache.rocketmq.client.exception.MQClientException: The producer service state not OK, maybe started once, RUNNING
   See http://rocketmq.apache.org/docs/faq/ for further details.
   	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:214)
   	at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:175)
   	at org.apache.rocketmq.client.producer.DefaultMQProducer.start(DefaultMQProducer.java:271)
   	at org.apache.rocketmq.client.producer.TransactionMQProducer.start(TransactionMQProducer.java:57)
   	at org.apache.rocketmq.spring.core.RocketMQTemplate.afterPropertiesSet(RocketMQTemplate.java:844)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
   	... 29 common frames omitted
   
   
   自己的配置如下:
    @Bean
       public TransactionMQProducer transactionMQProducer(RocketMQProperties rocketMQProperties) {
           RocketMQProperties.Producer producerConfig = rocketMQProperties.getProducer();
           TransactionMQProducer mqProducer = new TransactionMQProducer(PRODUCER_GROUP);
           mqProducer.setNamesrvAddr(NAME_SERVER);
           mqProducer.setSendMsgTimeout(producerConfig.getSendMessageTimeout());
           mqProducer.setRetryTimesWhenSendFailed(producerConfig.getRetryTimesWhenSendFailed());
           mqProducer.setRetryTimesWhenSendAsyncFailed(producerConfig.getRetryTimesWhenSendAsyncFailed());
           mqProducer.setMaxMessageSize(producerConfig.getMaxMessageSize());
           mqProducer.setCompressMsgBodyOverHowmuch(producerConfig.getCompressMessageBodyThreshold());
           mqProducer.setRetryAnotherBrokerWhenNotStoreOK(producerConfig.isRetryNextServer());
           return mqProducer;
       }
   
       @Bean(destroyMethod = "destroy")
       @ConditionalOnBean(TransactionMQProducer.class)
       public RocketMQTemplate transactionRocketMQTemplate(TransactionMQProducer transactionMQProducer,
                                                           RocketMQMessageConverter rocketMQMessageConverter) {
           RocketMQTemplate transactionRocketMQTemplate = new RocketMQTemplate();
           transactionRocketMQTemplate.setProducer(transactionMQProducer);
           transactionRocketMQTemplate.setMessageConverter(rocketMQMessageConverter.getMessageConverter());
           return transactionRocketMQTemplate;
       }
   
   RocketMQAutoConfiguration 自动注入的defaultMQProducer和我注入的transactionMQProducer,就产生了上面的问题,查看了源码,定位到DefaultMQProducerImpl start(final boolean startFactory)方法的问题,下一步怎么解决?


----------------------------------------------------------------
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



[GitHub] [rocketmq] vongosling closed issue #2061: The same jvm fails to start multiple producers

Posted by GitBox <gi...@apache.org>.
vongosling closed issue #2061:
URL: https://github.com/apache/rocketmq/issues/2061


   


----------------------------------------------------------------
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



[GitHub] [rocketmq] vongosling commented on issue #2061: The same jvm fails to start multiple producers

Posted by GitBox <gi...@apache.org>.
vongosling commented on issue #2061:
URL: https://github.com/apache/rocketmq/issues/2061#issuecomment-637232426


   You could set instanceName or change your codebase to https://github.com/apache/rocketmq-spring with full-featured scaffold off-the-shelf.


----------------------------------------------------------------
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