zhaohai1299002788 commented on a change in pull request #1:
URL: https://github.com/apache/rocketmq-connect/pull/1#discussion_r821371495



##########
File path: 
connectors/aliyun/rocketmq-connect-mns/src/main/java/com/aliyun/rocketmq/connect/mns/source/MNSSourceConnector.java
##########
@@ -0,0 +1,94 @@
+package com.aliyun.rocketmq.connect.mns.source;
+
+import io.openmessaging.KeyValue;
+import io.openmessaging.connector.api.component.connector.ConnectorContext;
+import io.openmessaging.connector.api.component.task.Task;
+import io.openmessaging.connector.api.component.task.source.SourceConnector;
+import io.openmessaging.internal.DefaultKeyValue;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.aliyun.rocketmq.connect.mns.source.constant.MNSConstant.*;
+
+public class MNSSourceConnector extends SourceConnector {
+
+    private String accessKeyId;
+
+    private String accessKeySecret;
+
+    private String accountEndpoint;
+
+    private String queueName;
+
+    private String accountId;
+
+    private String isBase64Decode;
+
+    private Integer batchSize;
+
+    @Override
+    public void pause() {
+
+    }
+
+    @Override
+    public void resume() {
+
+    }
+
+    @Override
+    public List<KeyValue> taskConfigs(int maxTasks) {
+        List<KeyValue> taskConfigList = new ArrayList<>(11);
+        KeyValue keyValue = new DefaultKeyValue();
+        keyValue.put(ACCESS_KEY_ID, accessKeyId);
+        keyValue.put(ACCESS_KEY_SECRET, accessKeySecret);
+        keyValue.put(ACCOUNT_ENDPOINT, accountEndpoint);
+        keyValue.put(QUEUE_NAME, queueName);
+        keyValue.put(ACCOUNT_ID, accountId);
+        if (batchSize == null) {
+            keyValue.put(BATCH_SIZE, 8);
+        }
+        keyValue.put(IS_BASE64_DECODE, isBase64Decode);
+        taskConfigList.add(keyValue);
+        return taskConfigList;
+    }
+
+    @Override
+    public Class<? extends Task> taskClass() {
+        return MNSSourceTask.class;
+    }
+
+    @Override
+    public void validate(KeyValue config) {
+        if (StringUtils.isBlank(config.getString(ACCESS_KEY_ID))
+                || StringUtils.isBlank(config.getString(ACCESS_KEY_SECRET))
+                || StringUtils.isBlank(config.getString(ACCOUNT_ENDPOINT))
+                || StringUtils.isBlank(config.getString(QUEUE_NAME))
+                || StringUtils.isBlank(config.getString(ACCOUNT_ID))) {
+            throw new RuntimeException("mns required parameter is null !");
+        }

Review comment:
       Queue name check added




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to