flink-api-spring-boot-starter

flink api for spring boot

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

com.github.codingdebugallday
ArtifactId

ArtifactId

flink-api-spring-boot-starter
Last Version

Last Version

1.0.4.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

flink-api-spring-boot-starter
flink api for spring boot
Project URL

Project URL

https://github.com/codingdebugallday/flink-api-spring-boot-starter
Source Code Management

Source Code Management

https://github.com/codingdebugallday/flink-api-spring-boot-starter

Download flink-api-spring-boot-starter

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.codingdebugallday/flink-api-spring-boot-starter/ -->
<dependency>
    <groupId>com.github.codingdebugallday</groupId>
    <artifactId>flink-api-spring-boot-starter</artifactId>
    <version>1.0.4.RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.codingdebugallday/flink-api-spring-boot-starter/
implementation 'com.github.codingdebugallday:flink-api-spring-boot-starter:1.0.4.RELEASE'
// https://jarcasting.com/artifacts/com.github.codingdebugallday/flink-api-spring-boot-starter/
implementation ("com.github.codingdebugallday:flink-api-spring-boot-starter:1.0.4.RELEASE")
'com.github.codingdebugallday:flink-api-spring-boot-starter:jar:1.0.4.RELEASE'
<dependency org="com.github.codingdebugallday" name="flink-api-spring-boot-starter" rev="1.0.4.RELEASE">
  <artifact name="flink-api-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.codingdebugallday', module='flink-api-spring-boot-starter', version='1.0.4.RELEASE')
)
libraryDependencies += "com.github.codingdebugallday" % "flink-api-spring-boot-starter" % "1.0.4.RELEASE"
[com.github.codingdebugallday/flink-api-spring-boot-starter "1.0.4.RELEASE"]

Dependencies

compile (16)

Group / Artifact Type Version
com.google.guava : guava jar 28.2-jre
org.projectlombok : lombok Optional jar 1.18.12
com.github.ulisesbocchio : jasypt-spring-boot-starter jar 3.0.2
org.springframework.boot : spring-boot-autoconfigure jar 2.2.4.RELEASE
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.2.4.RELEASE
org.springframework.boot : spring-boot-starter-jdbc jar 2.2.4.RELEASE
com.baomidou : mybatis-plus-boot-starter jar 3.3.1
org.mybatis.spring.boot : mybatis-spring-boot-starter jar 2.1.2
com.baomidou : dynamic-datasource-spring-boot-starter jar 3.0.0
org.springframework.boot : spring-boot-starter-aop jar 2.2.4.RELEASE
org.springframework.boot : spring-boot-starter-web jar 2.2.4.RELEASE
mysql : mysql-connector-java jar 5.1.48
javax.persistence : persistence-api jar 1.0.2
org.mapstruct : mapstruct jar 1.3.1.Final
com.alibaba : transmittable-thread-local jar 2.11.0
org.apache.httpcomponents : httpclient jar 4.5.10

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.2.4.RELEASE

Project Modules

There are no modules declared in this project.

flink-api-spring-boot-starter

  • 基于flink rest api开发的spring boot starter,可上传/运行jar等一系列操作

Quick Start

  1. 执行src/main/resources/sql/flink_explore.sql
  2. jar已发布到中仓仓库,直接依赖即可
<dependency>
    <groupId>com.github.codingdebugallday</groupId>
    <artifactId>flink-api-spring-boot-starter</artifactId>
    <version>1.0.3.RELEASE</version>
</dependency>
  1. spring boot配置文件如示例,src/main/resources/application.yml
  2. 创建自己的flink集群, 已内置com/github/codingdebugallday/client/api/controller/v1/ClusterController.java许多接口

url: http://localhost:9527/v1/{tenantId}/cluster

method: post

{
    "clusterCode": "hdspdev",
    "clusterDesc": "hdspdev",
    "jobManagerUrl": "http://hdspdev002:50100",
    "username": "root",
    "password": "m8rW2EQ0iDCcWlbH",
    "jobManagerStandbyUrl": "http://hdspdev001:50100",
    "enabledFlag": 1,
    "tenantId": 0,
    "nodeDTOList": [
    	 {
            "nodeCode": "flink_hdspdev001",
            "nodeDesc": "hdspdev001",
            "nodeType":"MARSTER",
            "settingInfo": "{\"host\":\"hdspdev001\",\"username\":\"root\",\"password\":\"m8rW2EQ0iDCcWlbH\"}"
        },
        {
            "nodeCode": "flink_hdspdev002",
            "nodeDesc": "hdspdev002",
            "nodeType":"SLAVE",
            "settingInfo": "{\"host\":\"hdspdev002\",\"username\":\"root\",\"password\":\"m8rW2EQ0iDCcWlbH\"}"
        },
        {
            "nodeCode": "flink_hdspdev003",
            "nodeDesc": "hdspdev003",
            "nodeType":"SLAVE",
            "settingInfo": "{\"host\":\"hdspdev003\",\"username\":\"root\",\"password\":\"m8rW2EQ0iDCcWlbH\"}"
        },
        {
            "nodeCode": "flink_hdspdev004",
            "nodeDesc": "hdspdev004",
            "nodeType":"SLAVE",
            "settingInfo": "{\"host\":\"hdspdev004\",\"username\":\"root\",\"password\":\"m8rW2EQ0iDCcWlbH\"}"
        },
        {
            "nodeCode": "flink_hdspdev005",
            "nodeDesc": "hdspdev005",
            "nodeType":"SLAVE",
            "settingInfo": "{\"host\":\"hdspdev005\",\"username\":\"root\",\"password\":\"m8rW2EQ0iDCcWlbH\"}"
        },
        {
            "nodeCode": "flink_hdspdev006",
            "nodeDesc": "hdspdev006",
            "nodeType":"SLAVE",
            "settingInfo": "{\"host\":\"hdspdev006\",\"username\":\"root\",\"password\":\"m8rW2EQ0iDCcWlbH\"}"
        }
    ]
}
  1. 使用

首先获取FlinkApiContext,然后通过clusterCode以及tenantId获取flinkApi, flinkApi即可调用api,如uploadJar/runJar/jobList等

会自动重试3次,如jm master挂了,会切换到备用节点进行访问

@Autowired
private FlinkApiContext flinkApiContext;

FlinkApi flinkApi = flinkApiContext.get(clusterCode, tenantId);
flinkApi.uploadJar(file)

Versions

Version
1.0.4.RELEASE
1.0.3.RELEASE
1.0.2.RELEASE
1.0.1.RELEASE
1.0.0.RELEASE
1.0.0