Java Code Examples for io.smallrye.mutiny.Uni#emitOn()

The following examples show how to use io.smallrye.mutiny.Uni#emitOn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Wrappers.java    From quarkus with Apache License 2.0 5 votes vote down vote up
static <T> Uni<T> toUni(Publisher<T> publisher) {
    Context context = Vertx.currentContext();
    Uni<T> uni = Uni.createFrom().publisher(publisher);
    if (context != null) {
        return uni.emitOn(command -> context.runOnContext(x -> command.run()));
    }
    return uni;
}
 
Example 2
Source File: Wrappers.java    From quarkus with Apache License 2.0 5 votes vote down vote up
static <T> Uni<List<T>> toUniOfList(Publisher<T> publisher) {
    Context context = Vertx.currentContext();
    Uni<List<T>> uni = Multi.createFrom().publisher(publisher)
            .collectItems().asList();

    if (context != null) {
        return uni.emitOn(command -> context.runOnContext(x -> command.run()));
    }
    return uni;
}