File tree 1 file changed +4
-2
lines changed
api/src/main/java/io/kafbat/ui/service
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 16
16
import org .apache .kafka .clients .admin .AdminClientConfig ;
17
17
import org .springframework .stereotype .Service ;
18
18
import reactor .core .publisher .Mono ;
19
+ import reactor .core .scheduler .Schedulers ;
19
20
20
21
@ Service
21
22
@ Slf4j
@@ -41,7 +42,7 @@ public Mono<ReactiveAdminClient> get(KafkaCluster cluster) {
41
42
}
42
43
43
44
private Mono <ReactiveAdminClient > createAdminClient (KafkaCluster cluster ) {
44
- return Mono .fromFuture ( CompletableFuture . supplyAsync (() -> {
45
+ return Mono .fromSupplier (() -> {
45
46
Properties properties = new Properties ();
46
47
KafkaClientSslPropertiesUtil .addKafkaSslProperties (cluster .getOriginalProperties ().getSsl (), properties );
47
48
properties .putAll (cluster .getProperties ());
@@ -52,7 +53,8 @@ private Mono<ReactiveAdminClient> createAdminClient(KafkaCluster cluster) {
52
53
"kafbat-ui-admin-" + Instant .now ().getEpochSecond () + "-" + CLIENT_ID_SEQ .incrementAndGet ()
53
54
);
54
55
return AdminClient .create (properties );
55
- })).flatMap (ac -> ReactiveAdminClient .create (ac ).doOnError (th -> ac .close ()))
56
+ }).subscribeOn (Schedulers .boundedElastic ())
57
+ .flatMap (ac -> ReactiveAdminClient .create (ac ).doOnError (th -> ac .close ()))
56
58
.onErrorMap (th -> new IllegalStateException (
57
59
"Error while creating AdminClient for the cluster " + cluster .getName (), th ));
58
60
}
You can’t perform that action at this time.
0 commit comments