Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Wait for topic creation to complete in tests #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noslowerdna
Copy link
Member

When we create topics in our tests, we need to wait for the creation to complete, since it's async with the result wrapping a collection of futures.

For reference solution see example code from open-source Kafka,

        Admin adminClient = Admin.create(adminProps);
        NewTopic newTopic = new NewTopic(topic, DEFAULT_NUM_PARTITIONS, DEFAULT_REPLICATION_FACTOR);
        try {
            adminClient.createTopics(Collections.singleton(newTopic)).all().get();
        } catch (ExecutionException | InterruptedException e) {
            System.out.printf("Creation of topic %s failed%n", topic);
            throw new RuntimeException(e);
        } finally {
            Utils.closeQuietly(adminClient, "AdminClient");
        }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant