forked from DataLinkDC/dinky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature-275][client] Add Flink client 1.15
- Loading branch information
Showing
29 changed files
with
2,364 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>dlink-app</artifactId> | ||
<groupId>com.dlink</groupId> | ||
<version>0.6.2</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>dlink-app-1.15</artifactId> | ||
|
||
<properties> | ||
<mainClass>com.dlink.app.MainApp</mainClass> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-app-base</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<!-- <scope>provided</scope>--> | ||
<version>8.0.21</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-client-1.15</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-flink-1.15</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-client-base</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-executor</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>*.properties</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
|
||
<plugins> | ||
<!-- 编译插件 --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
<encoding>UTF-8</encoding> | ||
</configuration> | ||
</plugin> | ||
|
||
<!-- 打jar包插件(会包含所有依赖) --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.6</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
<archive> | ||
<manifest> | ||
<!-- 可以设置jar包的入口类(可选) --> | ||
<mainClass>com.dlink.app.MainApp</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
dlink-app/dlink-app-1.15/src/main/java/com/dlink/app/MainApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.dlink.app; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import com.dlink.app.db.DBConfig; | ||
import com.dlink.app.flinksql.Submiter; | ||
import com.dlink.assertion.Asserts; | ||
import com.dlink.constant.FlinkParamConstant; | ||
import com.dlink.utils.FlinkBaseUtil; | ||
|
||
/** | ||
* MainApp | ||
* | ||
* @author wenmo | ||
* @since 2021/10/27 | ||
**/ | ||
public class MainApp { | ||
|
||
public static void main(String[] args) throws IOException { | ||
Map<String, String> params = FlinkBaseUtil.getParamsFromArgs(args); | ||
String id = params.get(FlinkParamConstant.ID); | ||
Asserts.checkNullString(id, "请配置入参 id "); | ||
DBConfig dbConfig = DBConfig.build(params); | ||
Submiter.submit(Integer.valueOf(id), dbConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>dlink-client</artifactId> | ||
<groupId>com.dlink</groupId> | ||
<version>0.6.2</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>dlink-client-1.15</artifactId> | ||
|
||
<properties> | ||
<java.version>1.8</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-client-base</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.dlink</groupId> | ||
<artifactId>dlink-flink-1.15</artifactId> | ||
<!-- <scope>provided</scope>--> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
69 changes: 69 additions & 0 deletions
69
dlink-client/dlink-client-1.15/src/main/java/com/dlink/cdc/AbstractCDCBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.dlink.cdc; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import com.dlink.assertion.Asserts; | ||
import com.dlink.constant.FlinkParamConstant; | ||
import com.dlink.model.FlinkCDCConfig; | ||
|
||
/** | ||
* AbstractCDCBuilder | ||
* | ||
* @author wenmo | ||
* @since 2022/4/12 21:28 | ||
**/ | ||
public abstract class AbstractCDCBuilder { | ||
|
||
protected FlinkCDCConfig config; | ||
|
||
public AbstractCDCBuilder() { | ||
} | ||
|
||
public AbstractCDCBuilder(FlinkCDCConfig config) { | ||
this.config = config; | ||
} | ||
|
||
public FlinkCDCConfig getConfig() { | ||
return config; | ||
} | ||
|
||
public void setConfig(FlinkCDCConfig config) { | ||
this.config = config; | ||
} | ||
|
||
public List<String> getSchemaList() { | ||
List<String> schemaList = new ArrayList<>(); | ||
String schema = config.getSchema(); | ||
if (Asserts.isNotNullString(schema)) { | ||
String[] schemas = schema.split(FlinkParamConstant.SPLIT); | ||
Collections.addAll(schemaList, schemas); | ||
} | ||
List<String> tableList = getTableList(); | ||
for (String tableName : tableList) { | ||
if (Asserts.isNotNullString(tableName) && tableName.contains(".")) { | ||
String[] names = tableName.split("\\\\."); | ||
if (!schemaList.contains(names[0])) { | ||
schemaList.add(names[0]); | ||
} | ||
} | ||
} | ||
return schemaList; | ||
} | ||
|
||
public List<String> getTableList() { | ||
List<String> tableList = new ArrayList<>(); | ||
String table = config.getTable(); | ||
if (Asserts.isNullString(table)) { | ||
return tableList; | ||
} | ||
String[] tables = table.split(FlinkParamConstant.SPLIT); | ||
Collections.addAll(tableList, tables); | ||
return tableList; | ||
} | ||
|
||
public String getSchemaFieldName() { | ||
return "schema"; | ||
} | ||
} |
Oops, something went wrong.