After you configure a change tracking task, you can use the SDK demo code that is provided by Data Transmission Service (DTS) to track and consume data. This topic describes how to use the SDK demo code to consume tracked data.
Before you begin
Create an AccessKey pair, which consists of an AccessKey ID and AccessKey secret. For more information, see Create an AccessKey pair.
IntelliJ IDEA (Community Edition 2018.1.4 Windows) is used in this example.
- Download the SDK demo code and decompress the package.
- Optional:Go to the directory where the package is decompressed, open the pom.xml file by using a text editor, and then change the SDK version to the latest.
- Open IntelliJ IDEA. In the window that appears, click Open.
- In the dialog box that appears, go to the directory where the package is decompressed,
and expand the folders to find the pom.xml file.
- In the dialog box that is displayed, select Open as Project.
- In the Project tool window of IntelliJ IDEA, expand the folders to find the demo file
of the Java client, and double-click the file. The file name is Main.java.
- Set the parameters for the demo file of the Java client.
Parameter Description accessKey Enter the AccessKey ID and AccessKey secret of your Alibaba Cloud account. For more information, see Before you begin. accessSecret subscribeInstanceID Enter the ID of the change tracking instance. To obtain the ID of the change tracking instance, perform the following steps: Log on to the DTS console. In the left-side navigation pane, click Change Tracking.
- In the top menu bar of IntelliJ IDEA, choose to run the client. Note The first time you run IntelliJ IDEA, a specific time period is required to load and install the relevant dependency.
The following figure shows that the Java client can track data changes from the source database.