Convert RxJava Single to Mono

chom :

I am new to RxJava and Spring webflux. Is there a way to convert RxJava Single to Mono?

I want to return a Mono<String> from the following function.

private Single<String> toNotification(PU update, Tx<PP> tx) {
    return findChannels(update.partyId(), update.notificationId(), tx)
        .toList()
        .flatMap(f -> Single.just("test"));
}

findChannels returns flowable

Sukhpal Singh :

You can use reactor.adapter.rxjava.RxJava2Adapter.singleToMono(io.reactivex.Single<T> source) which returns Mono<T>.

Source: RxJava2Adapter

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=89743&siteId=1