/** * Build a {@literal Broadcaster}, ready to broadcast values with {@link reactor.rx.action * .Broadcaster#onNext(Object)}, * {@link Broadcaster#onError(Throwable)}, {@link Broadcaster#onComplete()}. * Values broadcasted are directly consumable by subscribing to the returned instance. * * @param <T> the type of values passing through the {@literal Broadcaster} * @return a new {@link reactor.rx.broadcast.Broadcaster} */ public static <T> Broadcaster<T> create() { return new Broadcaster<T>(null, SynchronousDispatcher.INSTANCE, Long.MAX_VALUE); }
/** * Build a {@literal Broadcaster}, ready to broadcast values with {@link Broadcaster#onNext * (Object)}, * {@link Broadcaster#onError(Throwable)}, {@link Broadcaster#onComplete()}. * Values broadcasted are directly consumable by subscribing to the returned instance. * * @param env the Reactor {@link reactor.Environment} to use * @param dispatcher the {@link reactor.core.Dispatcher} to use * @param <T> the type of values passing through the {@literal Stream} * @return a new {@link Broadcaster} */ public static <T> Broadcaster<T> create(Environment env, Dispatcher dispatcher) { Assert.state(dispatcher.supportsOrdering(), "Dispatcher provided doesn't support event ordering. " + " For concurrent consume, refer to Stream#partition/groupBy() method and assign individual single " + "dispatchers"); return new Broadcaster<T>(env, dispatcher, Action.evaluateCapacity(dispatcher.backlogSize())); }
/** * Build a {@literal Broadcaster}, ready to broadcast values with {@link reactor.rx.action * .Broadcaster#onNext(Object)}, * {@link Broadcaster#onError(Throwable)}, {@link Broadcaster#onComplete()}. * Values broadcasted are directly consumable by subscribing to the returned instance. * * @param <T> the type of values passing through the {@literal Broadcaster} * @return a new {@link reactor.rx.broadcast.Broadcaster} */ public static <T> Broadcaster<T> create() { return new Broadcaster<T>(null, SynchronousDispatcher.INSTANCE, Long.MAX_VALUE); }
/** * Build a {@literal Broadcaster}, ready to broadcast values with {@link Broadcaster#onNext * (Object)}, * {@link Broadcaster#onError(Throwable)}, {@link Broadcaster#onComplete()}. * Values broadcasted are directly consumable by subscribing to the returned instance. * * @param env the Reactor {@link reactor.Environment} to use * @param dispatcher the {@link reactor.core.Dispatcher} to use * @param <T> the type of values passing through the {@literal Stream} * @return a new {@link Broadcaster} */ public static <T> Broadcaster<T> create(Environment env, Dispatcher dispatcher) { Assert.state(dispatcher.supportsOrdering(), "Dispatcher provided doesn't support event ordering. " + " For concurrent consume, refer to Stream#partition/groupBy() method and assign individual single " + "dispatchers"); return new Broadcaster<T>(env, dispatcher, Action.evaluateCapacity(dispatcher.backlogSize())); }