You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/01/10 06:53:22 UTC

[GitHub] [incubator-inlong] justinwwhuang commented on a change in pull request #2110: [INLONG-2109][manager] support db SQL collect

justinwwhuang commented on a change in pull request #2110:
URL: https://github.com/apache/incubator-inlong/pull/2110#discussion_r780924452



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/SqlJobProfileDto.java
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.agent.plugin.fetcher.dtos;
+
+import static org.apache.inlong.agent.plugin.fetcher.constants.FetcherConstants.AGENT_MANAGER_VIP_HTTP_HOST;
+import static org.apache.inlong.agent.plugin.fetcher.constants.FetcherConstants.AGENT_MANAGER_VIP_HTTP_PORT;
+
+import com.google.gson.Gson;
+import lombok.Data;
+import org.apache.inlong.agent.conf.AgentConfiguration;
+import org.apache.inlong.agent.conf.JobProfile;
+import org.apache.inlong.agent.conf.TriggerProfile;
+
+@Data
+public class SqlJobProfileDto {
+
+    private static final Gson GSON = new Gson();
+    private Job job;
+    private Proxy proxy;
+
+    public static final String SQL_JOB = "SQL_JOB";
+    public static final String DEFAULT_CHANNEL = "org.apache.inlong.agent.plugin.channel.MemoryChannel";
+    public static final String DEFAULT_BUS_SINK = "org.apache.inlong.agent.plugin.sinks.ProxySink";
+    public static final String DEFAULT_SOURCE = "org.apache.inlong.agent.plugin.sources.TextFileSource";
+
+    @Data
+    public static class Running {
+
+        private String core;
+    }
+
+    @Data
+    public static class Thread {
+
+        private Running running;
+    }
+
+    @Data
+    public static class Job {
+
+        private int id;
+        //private Thread thread;
+        private String name;
+        private String source;
+        private String sink;
+        private String channel;
+        //private String pattern;
+        //private String op;
+        //private String cycleUnit;
+        //private String timeOffset;
+        //private String deliveryTime;
+        //private String addictiveString;
+        private String ip;
+        private Integer port;
+        private String dbName;
+        private String user;
+        private String password;
+        private String sqlStatement;
+        private Integer totalLimit;
+        private Integer onceLimit;
+        private Integer timeLimit;
+        private Integer retryTimes;
+    }
+
+    @Data
+    public static class Manager {
+
+        private String port;
+        private String host;
+    }
+
+    @Data
+    public static class Proxy {
+
+        private String inlongGroupId;
+        private String inlongStreamId;
+        private Manager manager;
+    }
+
+    private static Job getJob(DbCollectorTask task) {
+        Job job = new Job();
+        job.setId(Integer.parseInt(task.getId()));
+        job.setName(SQL_JOB);
+        job.setSource(DEFAULT_SOURCE);
+        job.setSink(DEFAULT_BUS_SINK);
+        job.setChannel(DEFAULT_CHANNEL);
+        //job.setTimeOffset(dataConfigs.getTimeOffset());
+        //job.setOp(dataConfigs.getOp());
+        //job.setDeliveryTime(dataConfigs.getDeliveryTime());
+        //if (!dataConfigs.getAdditionalAttr().isEmpty()) {
+        //    job.setAddictiveString(dataConfigs.getAdditionalAttr());

Review comment:
       ok




-- 
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: commits-unsubscribe@inlong.apache.org

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