From 06dcb87ba40027784c2bd4165109d06f4e719bb6 Mon Sep 17 00:00:00 2001 From: Carsten Lohmann Date: Mon, 30 May 2022 15:22:05 +0200 Subject: [PATCH] [#3275] Fix NPE on Command Router startup. Signed-off-by: Carsten Lohmann --- .../impl/kafka/InternalKafkaTopicCleanupService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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); + }; } /**