Amazon Managed Service for Apache Flink was previously known as Amazon Kinesis Data Analytics for Apache Flink.
Update Java applications
Follow the procedures below to update Java applications:
flink-connector-kinesis
If the application uses flink-connector-kinesis
:
Kinesis connector uses shading to package some dependencies, including the AWS SDK, into the connector jar. To update the AWS SDK version, use the following procedure to replace these shaded classes:
- Maven
-
Add Kinesis connector and required AWS SDK modules as project dependencies.
Configure
maven-shade-plugin
:Add filter to exclude shaded AWS SDK classes when copying content of the Kinesis connector jar.
Add relocation rule to move updated AWS SDK classes to package, expected by Kinesis connector.
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
-
Add Kinesis connector and required AWS SDK modules as project dependencies.
Adjust shadowJar configuration:
Exclude shaded AWS SDK classes when copying content of the Kinesis connector jar.
Relocate updated AWS SDK classes to a package expected by Kinesis connector.
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") } ...
Other affected connectors
If the application uses another affected connector:
In order to update the AWS SDK version, the SDK version should be enforced in the project build configuration.
- Maven
-
Add AWS SDK bill of materials (BOM) to the dependency management section of the
pom.xml
file to enforce SDK version for the project.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
-
Add platform dependency on the AWS SDK bill of materials (BOM) to enforce SDK version for the project. This requires Gradle 5.0 or newer:
build.gradle
... dependencies { ... flinkShadowJar(platform("software.amazon.awssdk:bom:2.20.144")) ... } ...