Skip to content

Commit e5da666

Browse files
Update apache-kafka-2/src/test/java/com/baeldung/kafka/message/ordering/MultiplePartitionIntegrationTest.java
Co-authored-by: Liam Williams <liam.williams@zoho.com>
1 parent c2453a5 commit e5da666

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

apache-kafka-2/src/test/java/com/baeldung/kafka/message/ordering/MultiplePartitionIntegrationTest.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,7 @@ static void setup() throws ExecutionException, InterruptedException {
6060
admin = Admin.create(adminProperties);
6161
producer = new KafkaProducer<>(producerProperties);
6262
consumer = new KafkaConsumer<>(consumerProperties);
63-
List<NewTopic> topicList = new ArrayList<>();
64-
NewTopic newTopic = new NewTopic(Config.MULTI_PARTITION_TOPIC, Config.MULTIPLE_PARTITIONS, Config.REPLICATION_FACTOR);
65-
topicList.add(newTopic);
66-
CreateTopicsResult result = admin.createTopics(topicList);
67-
KafkaFuture<Void> future = result.values().get(Config.MULTI_PARTITION_TOPIC);
68-
future.whenComplete((voidResult, exception) -> {
69-
if (exception != null) {
70-
System.err.println("Error creating the topic: " + exception.getMessage());
71-
} else {
72-
System.out.println("Topic created successfully!");
73-
}
74-
}).get();
63+
admin.createTopics(ImmutableList.of(new NewTopic(Config.MULTI_PARTITION_TOPIC, Config.MULTIPLE_PARTITIONS, Config.REPLICATION_FACTOR))).all().get();
7564
}
7665

7766
@AfterAll

0 commit comments

Comments
 (0)