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.
https://central.sonatype.com/artifact/com.volcengine/volcengine-java-sdk-flink20250101/0.2.2
https://github.com/volcengine/volcengine-java-sdk/tree/master/volcengine-java-sdk-flink20250101
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>
Step 1: Integrate the service repository
<dependencies> <dependency> <groupId>com.volcengine</groupId> <artifactId>volcengine-java-sdk-flink20250101</artifactId> <version>0.2.2</version> </dependency> </dependencies>
<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
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 |
|---|---|
|
|
Note: If the Service name contains an underscore (_), it must be converted to a hyphen (-) in the Endpoint. Convert uppercase letters to lowercase.
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()); } } }