_05_backpressure._02_Buffer Maven / Gradle / Ivy
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.smallrye.reactive:mutiny:2.5.8
package _05_backpressure;
import java.util.concurrent.Flow.Subscription;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.subscription.BackPressureStrategy;
import io.smallrye.mutiny.subscription.MultiEmitter;
import io.smallrye.mutiny.subscription.MultiSubscriber;
public class _02_Buffer {
public static void main(String[] args) {
System.out.println("⚡️ Back-pressure: buffer");
Multi.createFrom().emitter(emitter -> emitTooFast(emitter), BackPressureStrategy.ERROR)
.onOverflow().buffer(32)
.subscribe().withSubscriber(new MultiSubscriber
© 2015 - 2024 Weber Informatics LLC | Privacy Policy