summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchaochaoc <[email protected]>2024-05-28 14:56:27 +0800
committerchaochaoc <[email protected]>2024-05-28 14:56:27 +0800
commit509d263eeb26f9e4cb164b2b9ffd54f0b588d5cd (patch)
treee4d719595b06f3015f89b96d92a940ab018d507c
parent0dbfc207f4bff08e1ecd0ed436502931742afbaa (diff)
chore: create app
-rw-r--r--pom.xml484
-rw-r--r--src/main/java/com/geedgenetworks/flink/easy/application/Applications.java19
-rw-r--r--src/main/resources/log4j2.properties32
3 files changed, 535 insertions, 0 deletions
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..72b75b7
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,484 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.geedgenetworks.flink.easy</groupId>
+ <artifactId>easy-application</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <java.version>11</java.version>
+ <maven.compiler.source>${java.version}</maven.compiler.source>
+ <maven.compiler.target>${java.version}</maven.compiler.target>
+ <scala.version>2.12.10</scala.version>
+ <scala.binary.version>2.12</scala.binary.version>
+ <flink.version>1.13.6</flink.version>
+
+ <easy.stream.version>1.2-beta2</easy.stream.version>
+
+ <slf4j.version>1.7.32</slf4j.version>
+ <log4j.version>2.17.1</log4j.version>
+ <junit.version>5.8.0</junit.version>
+ </properties>
+
+ <dependencies>
+ <!-- DEV -->
+ <dependency>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-annotations</artifactId>
+ <version>4.4.2</version>
+ </dependency>
+
+ <!-- LOG -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+
+ <!-- Easy stream -->
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-flink-shim</artifactId>
+ </dependency>
+
+ <!-- Pipeline -->
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-grouped-exec-pipeline</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-filter-pipeline</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-console-pipeline</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-join-pipeline</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-multi-rule-pipeline</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-select-pipeline</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+
+ <!-- Connector -->
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-kafka-connector</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-socket-connector</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-text-connector</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+
+ <!-- Format -->
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-json-format</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-csv-format</artifactId>
+ </dependency>
+
+ <!-- Flink -->
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-clients_${scala.binary.version}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-runtime_${scala.binary.version}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-runtime-web_${scala.binary.version}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-runtime-blink_${scala.binary.version}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-cep_${scala.binary.version}</artifactId>
+ </dependency>
+
+ <!-- Test -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- DEV -->
+ <dependency>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-annotations</artifactId>
+ <version>4.4.2</version>
+ </dependency>
+ <!-- LOG -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>${log4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${log4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <!-- API bridge between log4j 1 and 2 -->
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-1.2-api</artifactId>
+ <version>${log4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Test -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Easy Stream-->
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-common</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-core</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-grouped-exec-pipeline</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-filter-pipeline</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-console-pipeline</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-kafka-connector</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-socket-connector</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-json-format</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-csv-format</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.geedgenetworks.flink</groupId>
+ <artifactId>easy-stream-flink-shim</artifactId>
+ <version>${easy.stream.version}</version>
+ </dependency>
+
+ <!-- Flink -->
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-core</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-clients_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-runtime_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-runtime-web_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-connector-kafka_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-json</artifactId>
+ <version>${flink.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-common</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-runtime-blink_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.flink</groupId>
+ <artifactId>flink-cep_${scala.binary.version}</artifactId>
+ <version>${flink.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>3.1.2</version>
+ <configuration>
+ <suppressionsLocation>${basedir}/dev/suppressions.xml</suppressionsLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <configLocation>${basedir}/dev/checkstyle.xml</configLocation>
+ <logViolationsToConsole>true</logViolationsToConsole>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>8.40</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>java-style-check</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <sourceDirectories>src/main/java</sourceDirectories>
+ </configuration>
+ </execution>
+ <execution>
+ <id>java-test-style-check</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <testSourceDirectories>src/test/java</testSourceDirectories>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <version>4.4.2.2</version>
+ <configuration>
+ <xmlOutput>true</xmlOutput>
+ <!-- Low, Medium, High ('Low' is strictest) -->
+ <threshold>Low</threshold>
+ <effort>default</effort>
+ <spotbugsXmlOutputDirectory>${project.build.directory}/spotbugs</spotbugsXmlOutputDirectory>
+ <excludeFilterFile>${basedir}/dev/spotbugs-exclude.xml</excludeFilterFile>
+ <failOnError>true</failOnError>
+ </configuration>
+ <executions>
+ <execution>
+ <id>findbugs-main</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>findbugs-test</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <includeTests>true</includeTests>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>${maven.compiler.source}</source>
+ <target>${maven.compiler.target}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.5.1</version>
+ <executions>
+ <execution>
+ <id>default-shade</id>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <createDependencyReducedPom>false</createDependencyReducedPom>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <artifactSet>
+ <excludes>
+ <exclude>org.apache.flink:force-shading</exclude>
+ <exclude>com.google.code.findbugs:jsr305</exclude>
+ <exclude>org.slf4j:*</exclude>
+ <exclude>org.apache.logging.log4j:*</exclude>
+ <exclude>org.mockito:mockito-core</exclude>
+ </excludes>
+ </artifactSet>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.1.2</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project> \ No newline at end of file
diff --git a/src/main/java/com/geedgenetworks/flink/easy/application/Applications.java b/src/main/java/com/geedgenetworks/flink/easy/application/Applications.java
new file mode 100644
index 0000000..4deb56f
--- /dev/null
+++ b/src/main/java/com/geedgenetworks/flink/easy/application/Applications.java
@@ -0,0 +1,19 @@
+package com.geedgenetworks.flink.easy.application;
+
+import com.geedgenetworks.flink.easy.core.Runners;
+
+import java.net.URL;
+
+public enum Applications {
+ ;
+
+ public static void run(final String name) throws Exception {
+ final String path = String.format("/jobs/%s.yml", name);
+ final URL resource = JobApplication.class.getResource(path);
+ if (resource == null) {
+ throw new IllegalArgumentException(
+ String.format("Not found job '%s' in path [%s].", name, path));
+ }
+ Runners.run(resource.getPath());
+ }
+}
diff --git a/src/main/resources/log4j2.properties b/src/main/resources/log4j2.properties
new file mode 100644
index 0000000..d2455b2
--- /dev/null
+++ b/src/main/resources/log4j2.properties
@@ -0,0 +1,32 @@
+################################################################################
+# 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.
+################################################################################
+
+rootLogger.level = ERROR
+rootLogger.appenderRefs = console
+rootLogger.appenderRef.console.ref = ConsoleAppender
+
+appender.console.name = ConsoleAppender
+appender.console.type = CONSOLE
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-20c %x - %m%n
+
+logger.easy.name = com.geedgenetworks.flink.easy
+logger.easy.level = DEBUG
+logger.easy.appenderRefs = console
+logger.easy.appenderRef.console.ref = ConsoleAppender
+logger.easy.additivity = false