Skip to content

Commit acfe7a4

Browse files
iliaxiliax
andauthored
Azure Events Hub support fixed (#3540)
UnknownTopicOrPartitionException error suppressing added when calling describeConfigs() for brokers (Azure case). Co-authored-by: iliax <[email protected]>
1 parent 8d3bac8 commit acfe7a4

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/ReactiveAdminClient.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,24 @@ private static Mono<Map<Integer, List<ConfigEntry>>> loadBrokersConfig(AdminClie
212212
.map(brokerId -> new ConfigResource(ConfigResource.Type.BROKER, Integer.toString(brokerId)))
213213
.collect(toList());
214214
return toMono(client.describeConfigs(resources).all())
215-
// some kafka backends (like MSK serverless) do not support broker's configs retrieval,
216-
// in that case InvalidRequestException will be thrown
217-
.onErrorResume(InvalidRequestException.class, th -> {
218-
log.trace("Error while getting broker {} configs", brokerIds, th);
219-
return Mono.just(Map.of());
220-
})
215+
// some kafka backends don't support broker's configs retrieval,
216+
// and throw various exceptions on describeConfigs() call
217+
.onErrorResume(th -> th instanceof InvalidRequestException // MSK Serverless
218+
|| th instanceof UnknownTopicOrPartitionException, // Azure event hub
219+
th -> {
220+
log.trace("Error while getting configs for brokers {}", brokerIds, th);
221+
return Mono.just(Map.of());
222+
})
221223
// there are situations when kafka-ui user has no DESCRIBE_CONFIGS permission on cluster
222224
.onErrorResume(ClusterAuthorizationException.class, th -> {
223225
log.trace("AuthorizationException while getting configs for brokers {}", brokerIds, th);
224226
return Mono.just(Map.of());
225227
})
228+
// catching all remaining exceptions, but logging on WARN level
229+
.onErrorResume(th -> true, th -> {
230+
log.warn("Unexpected error while getting configs for brokers {}", brokerIds, th);
231+
return Mono.just(Map.of());
232+
})
226233
.map(config -> config.entrySet().stream()
227234
.collect(toMap(
228235
c -> Integer.valueOf(c.getKey().name()),

0 commit comments

Comments
 (0)