You need to enable JavaScript to run this app.
Streaming Computing Flink Version

Streaming Computing Flink Version

Copy page
Download PDF
SDK Reference
JAVA
Copy page
Download PDF
JAVA

Description

Here are the instructions for using the SDK for Real-time Compute for Flink. For complete API details, see the API documentation. Use API Explorer to quickly make API calls and get responses and code samples.

Download Address

Release Address

https://central.sonatype.com/artifact/com.volcengine/volcengine-java-sdk-flink20250101/0.2.2

Source Code Address

https://github.com/volcengine/volcengine-java-sdk/tree/master/volcengine-java-sdk-flink20250101

Installation Instructions

Prerequisites

Environment requirements

  • The SDK requires JDK Java 1.8.0_131+ to run. You can download the latest version.
  • Since javax.annotation-api is removed in Java 9 and later, you must add the following dependency if you are using Java 9 or a higher version:
<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>javax.annotation-api</artifactId>
    <version>1.3.2</version>
</dependency>

Installation steps

Step 1: Integrate the service repository

  1. Create a new Maven project. In the pom.xml file in the project directory, add the following settings to import the SDK dependency for the current product. After adding the dependency, the Maven project management tool will automatically download the relevant JAR packages.
<dependencies>
  <dependency>
    <groupId>com.volcengine</groupId>
    <artifactId>volcengine-java-sdk-flink20250101</artifactId>
   <version>0.2.2</version>
  </dependency>
</dependencies>
  1. If you need to add all cloud product SDKs supported by Volcengine, you can do so by using a BOM. As shown below, after adding volcengine-java-sdk-bom, you can add all supported services:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.volcengine</groupId>
            <artifactId>volcengine-java-sdk-bom</artifactId>
            <version>0.2.2</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Step 2: Configure Credentials
Import from environment variables:

export VOLCENGINE_ACCESS_KEY=your ak
export VOLCENGINE_SECRET_KEY=your sk
#如果使用token
export VOLCENGINE_SESSION_TOKEN=token

Usage Instructions

Configure Endpoint

If you want to customize the SDK Endpoint, you can set it as shown in the following code example:

ApiClient apiClient = new ApiClient()
        .setCredentials(Credentials.getCredentials(ak, sk))
        .setRegion(region).setEndpoint("ecs.cn-beijing-autodriving.volcengineapi.com");

Volcengine standard Endpoint rules:

Regional Service

Global Service

{service}.{region}.volcengineapi.com
For example, the domain for the ecs cloud service in the cn-beijing-autodriving Region is ecs.cn-beijing-autodriving.volcengineapi.com.

{service}.volcengineapi.com
For example, Access Control (iam) is a Global service, and its domain is iam.volcengineapi.com.

Note: If the Service name contains an underscore (_), it must be converted to a hyphen (-) in the Endpoint. Convert uppercase letters to lowercase.

SDK Example

The following SDK sample shows how to call the GetApplicationInstance API. You can replace it with any API supported by the SDK in your actual project.

/*** Example Code generated by Beijing Volcanoengine Technology.*/
package com.volcengine.sdk.example;
import com.volcengine.ApiClient;
import com.volcengine.ApiException;
import com.volcengine.sign.Credentials;
import com.volcengine.flink20250101.Flink20250101Api;
import com.volcengine.flink20250101.model.*;
public class TestGetApplicationInstance {
    public static void main(String[] args) throws Exception {
        String ak = "Your AK";
        String sk = "Your SK";
        String region = "cn-beijing";
        ApiClient apiClient = new ApiClient()
                .setCredentials(Credentials.getCredentials(ak, sk))
                .setRegion(region);
        Flink20250101Api api = new Flink20250101Api(apiClient);
        GetApplicationInstanceRequest getApplicationInstanceRequest = new GetApplicationInstanceRequest();
        try {
            GetApplicationInstanceResponse response = api.getApplicationInstance(getApplicationInstanceRequest);
            System.out.println(response);
        } catch (ApiException e) {
            System.out.println(e.getResponseBody());
        }
    }
}
Last updated: 2026.04.01 11:04:46