Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to kafka 0.10.2.0 #6

Merged
merged 2 commits into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
<artifactId>kafka-topic-client</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>

<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>0.9.0.0</version>
<artifactId>kafka_2.12</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>0.7</version>
<version>0.10</version>
</dependency>

</dependencies>
Expand Down Expand Up @@ -49,4 +54,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
5 changes: 4 additions & 1 deletion src/main/java/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.concurrent.TimeUnit;

import kafka.admin.AdminUtils;
import kafka.admin.RackAwareMode;
import kafka.admin.RackAwareMode.Safe$;
import kafka.utils.ZKStringSerializer$;
import kafka.utils.ZkUtils;

Expand All @@ -15,6 +17,7 @@ public class Client {
final static boolean resetTopic = Boolean.parseBoolean(System.getenv("RESET_TOPIC"));
final static int partitions = Integer.parseInt(System.getenv("NUM_PARTITIONS"));
final static int replication = Integer.parseInt(System.getenv("NUM_REPLICAS"));
final static RackAwareMode rackAwareMode = Safe$.MODULE$;

final static int nRetries = Integer.parseInt(System.getenv("NUM_CREATE_RETRIES"));

Expand Down Expand Up @@ -64,7 +67,7 @@ private static void tryCreate(ZkUtils zkUtils, String topicName, int nRetriesLef
System.out.println("Creating topic " + topicName);
Properties topicConfig = new Properties(); // add per-topic configurations settings here
try {
AdminUtils.createTopic(zkUtils, topicName, partitions, replication, topicConfig);
AdminUtils.createTopic(zkUtils, topicName, partitions, replication, topicConfig, rackAwareMode);
} catch (Exception e) {
if (nRetriesLeft <= 0) {
throw new RuntimeException("Failed to create topic \"" + topicName + "\". Is Kafka and Zookeeper running?");
Expand Down