All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.semantickernel.aiservices.google.implementation.MonoConverter Maven / Gradle / Ivy

There is a newer version: 1.4.2
Show newest version
// Copyright (c) Microsoft. All rights reserved.
package com.microsoft.semantickernel.aiservices.google.implementation;

import com.google.api.core.ApiFuture;
import reactor.core.publisher.Mono;

public class MonoConverter {
    public static  Mono fromApiFuture(ApiFuture apiFuture) {
        return Mono.create(sink -> {
            apiFuture.addListener(() -> {
                try {
                    T result = apiFuture.get();
                    sink.success(result);
                } catch (Exception e) {
                    sink.error(e);
                }
            }, runnable -> new Thread(runnable).start());
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy