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 2019/08/07 03:21:22 UTC

[GitHub] [rocketmq-externals] duhenglucky commented on a change in pull request #348: [ISSUE 345]merge rmq client and bugfix rmq sourceTask setNamesrv error

duhenglucky commented on a change in pull request #348: [ISSUE 345]merge rmq client and bugfix rmq sourceTask setNamesrv error
URL: https://github.com/apache/rocketmq-externals/pull/348#discussion_r311354848
 
 

 ##########
 File path: rocketmq-connect/rocketmq-connect-runtime/src/main/java/org/apache/rocketmq/connect/runtime/connectorwrapper/Worker.java
 ##########
 @@ -256,41 +278,25 @@ public synchronized void startTasks(Map<String, List<ConnectKeyValue>> taskConfi
                 Converter recordConverter = (Converter) converterClazz.newInstance();
 
                 if (task instanceof SourceTask) {
-                    DefaultMQProducer producer = new DefaultMQProducer();
-                    producer.setNamesrvAddr(keyValue.getString(RuntimeConfigDefine.NAMESRV_ADDR));
-                    String rmqProducerGroup = keyValue.getString(RuntimeConfigDefine.RMQ_PRODUCER_GROUP);
-                    if (StringUtils.isEmpty(rmqProducerGroup)) {
-                        rmqProducerGroup = connectConfig.getRmqProducerGroup();
-                    }
-                    producer.setProducerGroup(rmqProducerGroup);
-                    int operationTimeout = keyValue.getInt(RuntimeConfigDefine.OPERATION_TIMEOUT);
-                    if (operationTimeout <= 0) {
-                        producer.setSendMsgTimeout(connectConfig.getOperationTimeout());
+                    if (this.producer.getDefaultMQProducerImpl().getServiceState() == ServiceState.CREATE_JUST) {
 
 Review comment:
   It seems that use the ServiceState to keep there's only one producer isn't a good choice, how about adding checkServiceState() method in here? in this method, you can control the producer was only started once, and can also be used to launch multiple tasks in parallel in the future.

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


With regards,
Apache Git Services