public class Pipes<K,V>
extends java.lang.Object
Constructor and Description |
---|
Pipes() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Maybe<LazyFutureStream<V>> |
futureStream(K key) |
Maybe<LazyFutureStream<V>> |
futureStream(K key,
LazyReact reactor) |
Maybe<Adapter<V>> |
get(K key) |
Eval<V> |
nextOrNull(K key)
Return an Eval that allows retrieval of the next value from the attached pipe when get() is called
A value is returned if a value is present, otherwise null is returned if the publisher is complete or an error occurs
|
Eval<Maybe<V>> |
nextValue(K key)
Return an Eval that allows retrieval of the next value from the attached pipe when get() is called
Maybe.some is returned if a value is present, Maybe.none is returned if the publisher is complete or an error occurs
|
static <K,V> Pipes<K,V> |
of() |
static <K,V> Pipes<K,V> |
of(java.util.Map<K,Adapter<V>> registered) |
Xor<java.lang.Throwable,V> |
oneOrError(K key) |
FutureW<V> |
oneOrErrorAsync(K key,
java.util.concurrent.Executor ex) |
Maybe<V> |
oneValue(K key)
Extract one value from the selected pipe, if it exists
|
Maybe<Try<V,java.lang.Throwable>> |
oneValueOrError(K key) |
<X extends java.lang.Throwable> |
oneValueOrError(K key,
java.lang.Class<X>... classes) |
void |
publishTo(K key,
org.reactivestreams.Publisher<V> publisher) |
void |
publishToAsync(K key,
org.reactivestreams.Publisher<V> publisher) |
void |
push(K key,
V value) |
Maybe<ReactiveSeq<V>> |
reactiveSeq(K key) |
void |
register(K key,
Adapter<V> adapter)
Register a Queue, and get back a listening LazyFutureStream that runs on a single thread
(not the calling thread)
|
PMapX<K,Adapter<V>> |
registered() |
int |
size() |
void |
subscribeTo(K key,
org.reactivestreams.Subscriber<V> subscriber)
Subscribe synchronously to a pipe
|
void |
subscribeTo(K key,
org.reactivestreams.Subscriber<V> subscriber,
java.util.concurrent.Executor subscribeOn)
Subscribe asynchronously to a pipe
|
ListX<V> |
xValues(K key,
long x) |
public int size()
public static <K,V> Pipes<K,V> of()
public Maybe<Adapter<V>> get(K key)
key
- : Adapter identifierpublic Maybe<LazyFutureStream<V>> futureStream(K key)
key
- : Adapter identifierpublic Maybe<LazyFutureStream<V>> futureStream(K key, LazyReact reactor)
key
- : Adapter identifierpublic Maybe<ReactiveSeq<V>> reactiveSeq(K key)
key
- : Adapter identifierpublic Maybe<V> oneValue(K key)
key
- : Adapter identifierpublic <X extends java.lang.Throwable> Maybe<Try<V,X>> oneValueOrError(K key, java.lang.Class<X>... classes)
public Eval<Maybe<V>> nextValue(K key)
key
- public Eval<V> nextOrNull(K key)
key
- public void register(K key, Adapter<V> adapter)
Pipes.register("test", QueueFactories.
<String>boundedNonBlockingQueue(100)
.build());
LazyFutureStream<String> stream = PipesToLazyStreams.cpuBoundStream("test");
stream.filter(it->it!=null).peek(System.out::println).run();
key
- : Adapter identifieradapter
- public void clear()
public void subscribeTo(K key, org.reactivestreams.Subscriber<V> subscriber)
key
- for registered simple-react async.Adaptersubscriber
- Reactive Streams subscriber for data on this pipepublic void subscribeTo(K key, org.reactivestreams.Subscriber<V> subscriber, java.util.concurrent.Executor subscribeOn)
key
- for registered simple-react async.Adaptersubscriber
- Reactive Streams subscriber for data on this pipepublic void publishTo(K key, org.reactivestreams.Publisher<V> publisher)
key
- for registered simple-react async.Adapterpublisher
- Reactive Streams publisher to push data onto this pipe