diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java index 11860f6fd2..11da600723 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/InternalKafkaTopicCleanupService.java @@ -79,11 +79,13 @@ public InternalKafkaTopicCleanupService( Objects.requireNonNull(adminClientConfigProperties); final var adminClientConfig = adminClientConfigProperties.getAdminClientConfig(CLIENT_NAME); - final var kafkaClientFactory = new KafkaClientFactory(vertx); - this.kafkaAdminClientCreator = () -> kafkaClientFactory.createKafkaAdminClientWithRetries( - adminClientConfig, - lifecycleStatus::isStarting, - KafkaClientFactory.UNLIMITED_RETRIES_DURATION); + this.kafkaAdminClientCreator = () -> { + final var kafkaClientFactory = new KafkaClientFactory(vertx); + return kafkaClientFactory.createKafkaAdminClientWithRetries( + adminClientConfig, + lifecycleStatus::isStarting, + KafkaClientFactory.UNLIMITED_RETRIES_DURATION); + }; } /**