Skip to content

Commit 9ee820d

Browse files
committed
fix: Throw NotFoundException when TopicPartition set is empty
1 parent 5ec7b53 commit 9ee820d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/src/main/java/io/kafbat/ui/service/ReactiveAdminClient.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,11 @@ public Mono<Void> deleteConsumerGroupOffsets(String groupId, String topicName) {
445445
Set<TopicPartition> partitions = table.row(groupId).keySet().stream()
446446
.filter(tp -> tp.topic().equals(topicName))
447447
.collect(Collectors.toSet());
448-
return toMono(client.deleteConsumerGroupOffsets(groupId, partitions).all());
448+
// check if partitions have no committed offsets
449+
return partitions.isEmpty()
450+
? Mono.error(new NotFoundException("The topic or partition is unknown"))
451+
// call deleteConsumerGroupOffsets
452+
: toMono(client.deleteConsumerGroupOffsets(groupId, partitions).all());
449453
})
450454
.onErrorResume(GroupIdNotFoundException.class,
451455
th -> Mono.error(new NotFoundException("The group id does not exist")))

0 commit comments

Comments
 (0)