Java Code Examples for reactor.core.publisher.Flux#switchOnFirst()

The following examples show how to use reactor.core.publisher.Flux#switchOnFirst() . These examples are extracted from open source projects. 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
@Override
@NotNull
public Flux<Payload> requestChannel(@NotNull Publisher<Payload> payloads) {
    if (payloads instanceof Flux) {
        Flux<Payload> payloadsWithSignalRouting = (Flux<Payload>) payloads;
        return payloadsWithSignalRouting.switchOnFirst((signal, flux) -> requestChannel(signal.get(), flux.skip(1)));
    }
    return Flux.error(new InvalidException(RsocketErrorCode.message("RST-201400")));
}
 
Example 2
@Override
public @NotNull Flux<Payload> requestChannel(@NotNull Publisher<Payload> payloads) {
    if (payloads instanceof Flux) {
        Flux<Payload> payloadsWithSignalRouting = (Flux<Payload>) payloads;
        //noinspection ConstantConditions
        return payloadsWithSignalRouting.switchOnFirst((signal, flux) -> requestChannel(signal.get(), flux.skip(1)));
    }
    return Flux.error(new InvalidException(RsocketErrorCode.message("RST-201400")));
}
 
Example 3
@SuppressWarnings("ConstantConditions")
@Override
@NotNull
public final Flux<Payload> requestChannel(@NotNull Publisher<Payload> payloads) {
    if (payloads instanceof Flux) {
        Flux<Payload> payloadsWithSignalRouting = (Flux<Payload>) payloads;
        return payloadsWithSignalRouting.switchOnFirst((signal, flux) -> requestChannel(signal.get(), flux.skip(1)));
    }
    return Flux.error(new InvalidException(RsocketErrorCode.message("RST-201400")));
}