After you configure a change tracking task, you can use the SDK demo code that is
provided by 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.
Notice If you track and consume data as a RAM user, the
AliyunDTSFullAccess permission must be granted to the RAM user. For more information, see
Authorize a RAM user to use DTS.
Procedure
IntelliJ IDEA (Community Edition 2018.1.4 Windows) is used in this example.
- Download the SDK demo code package, and then 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 appears, select Open as Project.
- On the IntelliJ IDEA page, 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, you must log on to the DTS console, and then click Change Tracking in the left-side navigation pane.
|
- On the top of the IntelliJ IDEA page, choose to run the client.
Note On the first run, the software loads and installs the relevant dependency package.
Result
The following figure shows that the Java client can track data changes from the source
database.