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

io.smallrye.mutiny.vertx.MultiHelper Maven / Gradle / Ivy

There is a newer version: 3.17.1
Show newest version
package io.smallrye.mutiny.vertx;

import java.util.function.Function;

import io.smallrye.mutiny.Multi;
import io.vertx.core.streams.ReadStream;

public class MultiHelper {

    /**
     * Adapts an Mutiny {@link Multi} to a Vert.x {@link io.vertx.core.streams.ReadStream}. The returned
     * {@code ReadStream} will be subscribed to the {@link Multi}.
     * 

* * @param observable the observable to adapt * @return the adapted stream */ public static ReadStream toReadStream(Multi observable) { return ReadStreamSubscriber.asReadStream(observable, Function.identity()); } /** * Like {@link #toMulti(ReadStream)} but with a {@code mapping} function */ public static Multi toMulti(ReadStream stream, Function mapping) { return new MultiReadStream<>(stream, mapping); } /** * Adapts a Vert.x {@link ReadStream} to an Mutiny {@link Multi}. After * the stream is adapted to a Multi, the original stream handlers should not be used anymore * as they will be used by the Multi adapter. *

* * @param stream the stream to adapt * @return the adapted observable */ public static Multi toMulti(ReadStream stream) { return new MultiReadStream<>(stream, Function.identity()); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy