Skip to content

Commit 1394665

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

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,7 @@ static void setup() throws ExecutionException, InterruptedException {
6868
admin = Admin.create(adminProperties);
6969

7070

71-
List<NewTopic> topicList = new ArrayList<>();
72-
NewTopic newTopic = new NewTopic(Config.SINGLE_PARTITION_TOPIC, Config.SINGLE_PARTITION, Config.REPLICATION_FACTOR);
73-
topicList.add(newTopic);
74-
CreateTopicsResult result = admin.createTopics(topicList);
75-
KafkaFuture<Void> future = result.values().get(Config.SINGLE_PARTITION_TOPIC);
76-
future.whenComplete((voidResult, exception) -> {
77-
if (exception != null) {
78-
System.err.println("Error creating the topic: " + exception.getMessage());
79-
} else {
80-
System.out.println("Topic created successfully!");
81-
}
82-
}).get();
71+
admin.createTopics(ImmutableList.of(new NewTopic(Config.SINGLE_PARTITION_TOPIC, Config.SINGLE_PARTITION, Config.REPLICATION_FACTOR))).all().get();
8372
}
8473

8574
@AfterAll

0 commit comments

Comments
 (0)