Updated on 2024-10-25 GMT+08:00

Preparations

Configuring the pom.xml File

If a maven project exists, use the following dependency in pom.xml:

<dependency>
    <groupId>com.huaweicloud.dis</groupId>
    <artifactId>huaweicloud-dis-kafka-adapter</artifactId>
    <version>1.2.18</version>
</dependency>

Using the DIS Sample Project

Download the package from https://dis-publish.obs-website.cn-north-1.myhuaweicloud.com/.

The .zip package contains two directories.

  • The huaweicloud-dis-kafka-adapter-X.X.X directory contains all JAR packages. If a non-maven project is used, import all JAR packages in the lib directory to the environment.
  • huaweicloud-dis-kafka-adapter--X.X.X-demo is a sample project and is compiled using maven.

You can use IntelliJ IDEA to import the sample project as follows:

  1. Run IntelliJ IDEA and choose File > Open.

    In the displayed dialog box, expand huaweicloud-dis-kafka-adapter-X.X.X-demo and double-click pom.xml.

  2. When the following dialog box is displayed, select Open as Project.

  3. Click New Window to open the project in a new window.

  4. Wait when IntelliJ IDEA is building the project. After the project is built, the directory and files are displayed.

Checking Authentication Information

  • AK/SK file

    Access Key ID/Secret Access Key (AK/SK) files are created by the Identity and Access Management (IAM) service to authenticate calls to application programming interfaces (APIs) on the public cloud.

    To obtain an access key, perform the following steps:
    1. Log in to the management console, move the cursor to the username in the upper right corner, and select My Credentials from the drop-down list.
    2. On the My Credentials page, choose Access Keys, and click Create Access Key. See Figure 1.
      Figure 1 Clicking Create Access Key
    3. Click OK and save the access key file as prompted. The access key file will be saved to your browser's configured download location. Open the credentials.csv file to view Access Key Id and Secret Access Key.
      • Only two access keys can be added for each user.
      • To ensure access key security, the access key is automatically downloaded only when it is generated for the first time and cannot be obtained from the management console later. Keep them properly.
  • Project ID
    A project is a group of tenant resources, and an account ID corresponds to the current account. The IAM ID corresponds to the current user. You can view the project IDs, account IDs, and user IDs in different regions on the corresponding pages.
    1. Register with and log in to the management console.
    2. Hover the cursor on the username in the upper right corner and select My Credentials from the drop-down list.
    3. On the API Credentials page, obtain the account name, account ID, IAM username, and IAM user ID, and obtain the project and its ID from the project list.