Creating a Project
This section uses the Maven project kafkademo as an example to describe how to create a project.
Procedure
- Download the demo package.
- Log in to the DMS console.
- In the navigation pane, choose Using APIs.
- Choose Kafka APIs.
- Click Download Sample Code to download DmsKafkaDemo.zip.
- Click Download SDK to download the DMS Kafka SASL package.
Decompress the following directories from the package:
- client.truststore.jks: client certificate
- dms.kafka.sasl.client-1.0.0.jar: DMS Kafka SASL package
- dms_kafka_client_jaas.conf: client configuration file
You can also decompress the SDK package from \DmsKafkaDemo\dist\libs\dms.kafka.sasl.client-1.0.0.jar.
- On Eclipse (the recommended version is 4.6 or later), create a Maven project. The project name kafkademo is used as an example. Figure 1 Creating a Maven project
- Click Finish.
- Import the DMS Kafka SASL package.
- Right-click the new project kafkademo, and create a libs folder.
- Copy dms.kafka.sasl.client-1.0.0.jar to libs.
- Add the following information to the pom.xml file to import dms.kafka.sasl.client-1.0.0.jar into the Maven repository:
<dependency> <groupId>dms</groupId> <artifactId>kafka.sasl.client</artifactId> <version>1.0.0</version> <scope>system</scope> <systemPath>${project.basedir}/libs/dms.kafka.sasl.client-1.0.0.jar</systemPath> </dependency> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version>0.10.2.1</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.7</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.7</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> - Save the pom.xml file.
Last Article: Preparing the Environment
Next Article: Configuring Parameters
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.