After configuring the change tracking channel, you can use the SDK sample code provided by DTS to track data changes. This topic describes how to use the sample code.
Create an AccessKey and obtain the AccessKey ID and AccessKey Secret. For more information, see create an AccessKey pair.
This topic uses IntelliJ IDEA (version Community Edition 2018.1.4 Windows) as an example to describe how to run the SDK to consume tracked data.
- Download SDK sample code files, and then decompress the file.
- Optional:Locate to the directory where you extracted the SDK sample code, and use text editing tools to open the pom.xml, then change the SDK version to the latest.
- Open IntelliJ IDEA. In the window that appears, click Open.
- In the dialog box that appears, locate the directory where the SDK sample code is
decompressed, expand the folders, and locate the project object model File: pom.xml.
- In the dialog box that appears, select Open as Project.
- On the IntelliJ IDEA page, double-click the target file: Main.java.
- Set the parameters in the Java client file.
Parameter Description accessKey Enter the AccessKey ID and AccessKey Secret of the Alibaba cloud account. For more information, see Preparations. accessSecret subscribeInstanceID The ID of the target instance. You can log in DTS console. In the left-side navigation pane, click Change Tracking Tasks and find the target instance ID.
- 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.
The following figure shows that the Kafka client can track data changes in the source database.