Amazon Managed Service for Apache Flink 之前稱為 Amazon Kinesis Data Analytics for Apache Flink。
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
更新 Java 應用程式
請依照下列程序更新 Java 應用程式:
flink-connector-kinesis
如果應用程式使用 flink-connector-kinesis
:
Kinesis 連接器使用著色將某些相依性,包括 AWS SDK封裝到連接器 jar 中。若要更新 AWS SDK版本,請使用下列程序取代這些陰影類別:
- Maven
-
將 Kinesis 連接器和必要 AWS SDK模組新增為專案相依性。
設定
maven-shade-plugin
:在複製 Kinesis 連接器 jar 的內容時,新增篩選條件以排除陰影 AWS SDK類別。
新增重新定位規則,以將更新 AWS SDK後的類別移至套件,這由 Kinesis 連接器預期。
pom.xml
<project> ... <dependencies> ... <dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-connector-kinesis</artifactId> <version>1.15.4</version> </dependency> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>kinesis</artifactId> <version>2.20.144</version> </dependency> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>netty-nio-client</artifactId> <version>2.20.144</version> </dependency> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>sts</artifactId> <version>2.20.144</version> </dependency> ... </dependencies> ... <build> ... <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.1.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> ... <filters> ... <filter> <artifact>org.apache.flink:flink-connector-kinesis</artifact> <excludes> <exclude>org/apache/flink/kinesis/shaded/software/amazon/awssdk/**</exclude> <exclude>org/apache/flink/kinesis/shaded/org/reactivestreams/**</exclude> <exclude>org/apache/flink/kinesis/shaded/io/netty/**</exclude> <exclude>org/apache/flink/kinesis/shaded/com/typesafe/netty/**</exclude> </excludes> </filter> ... </filters> <relocations> ... <relocation> <pattern>software.amazon.awssdk</pattern> <shadedPattern>org.apache.flink.kinesis.shaded.software.amazon.awssdk</shadedPattern> </relocation> <relocation> <pattern>org.reactivestreams</pattern> <shadedPattern>org.apache.flink.kinesis.shaded.org.reactivestreams</shadedPattern> </relocation> <relocation> <pattern>io.netty</pattern> <shadedPattern>org.apache.flink.kinesis.shaded.io.netty</shadedPattern> </relocation> <relocation> <pattern>com.typesafe.netty</pattern> <shadedPattern>org.apache.flink.kinesis.shaded.com.typesafe.netty</shadedPattern> </relocation> ... </relocations> ... </configuration> </execution> </executions> </plugin> ... </plugins> ... </build> </project>
- Gradle
-
將 Kinesis 連接器和必要 AWS SDK模組新增為專案相依性。
調整 shadowJar 組態:
複製 Kinesis 連接器 jar 的內容時,排除陰影 AWS SDK類別。
將更新的 AWS SDK類別重新定位至 Kinesis 連接器預期的套件。
build.gradle
... dependencies { ... flinkShadowJar("org.apache.flink:flink-connector-kinesis:1.15.4") flinkShadowJar("software.amazon.awssdk:kinesis:2.20.144") flinkShadowJar("software.amazon.awssdk:sts:2.20.144") flinkShadowJar("software.amazon.awssdk:netty-nio-client:2.20.144") ... } ... shadowJar { configurations = [project.configurations.flinkShadowJar] exclude("software/amazon/kinesis/shaded/software/amazon/awssdk/**/*") exclude("org/apache/flink/kinesis/shaded/org/reactivestreams/**/*.class") exclude("org/apache/flink/kinesis/shaded/io/netty/**/*.class") exclude("org/apache/flink/kinesis/shaded/com/typesafe/netty/**/*.class") relocate("software.amazon.awssdk", "org.apache.flink.kinesis.shaded.software.amazon.awssdk") relocate("org.reactivestreams", "org.apache.flink.kinesis.shaded.org.reactivestreams") relocate("io.netty", "org.apache.flink.kinesis.shaded.io.netty") relocate("com.typesafe.netty", "org.apache.flink.kinesis.shaded.com.typesafe.netty") } ...
其他受影響連接器
若應用程式使用其他受影響的連接器:
若要更新 AWS SDK版本,應在專案建置組態中強制執行SDK版本。
- Maven
-
將物料清單 (BOM) AWS SDK新增至
pom.xml
檔案的相依性管理區段,以強制執行專案的SDK版本。pom.xml
<project> ... <dependencyManagement> <dependencies> ... <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>bom</artifactId> <version>2.20.144</version> <scope>import</scope> <type>pom</type> </dependency> ... </dependencies> </dependencyManagement> ... </project>
- Gradle
-
新增對材料清單 (BOM) 的 AWS SDK平台相依性,以強制執行專案的SDK版本。這需要 Gradle 5.0 或更新版本:
build.gradle
... dependencies { ... flinkShadowJar(platform("software.amazon.awssdk:bom:2.20.144")) ... } ...
FLINK 1.15 非同步接收器死鎖
更新 Python 應用程式