T
- the type of element signaledpublic class PublisherBasedStreamMessage<T> extends java.lang.Object implements StreamMessage<T>
Publisher
into a StreamMessage
.Constructor and Description |
---|
PublisherBasedStreamMessage(org.reactivestreams.Publisher<? extends T> publisher)
Creates a new instance with the specified delegate
Publisher . |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Cancels the
Subscription if any and closes this publisher. |
java.util.concurrent.CompletableFuture<java.lang.Void> |
closeFuture()
Returns a
CompletableFuture that completes when this publisher is complete,
either successfully or exceptionally. |
protected org.reactivestreams.Publisher<? extends T> |
delegate()
Returns the delegate
Publisher . |
boolean |
isEmpty()
Returns
true if this stream has been closed and did not publish any elements. |
boolean |
isOpen()
Returns
true if this publisher is not closed yet. |
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber)
Requests to start streaming data to the specified
Subscriber . |
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber,
java.util.concurrent.Executor executor)
Requests to start streaming data, invoking the specified
Subscriber from the specified
Executor . |
public PublisherBasedStreamMessage(org.reactivestreams.Publisher<? extends T> publisher)
Publisher
.protected org.reactivestreams.Publisher<? extends T> delegate()
Publisher
.public boolean isOpen()
StreamMessage
true
if this publisher is not closed yet.isOpen
in interface StreamMessage<T>
public boolean isEmpty()
StreamMessage
true
if this stream has been closed and did not publish any elements.
Note that this method will not return true
when the stream is open even if it has not
published anything so far, because it may publish something later.isEmpty
in interface StreamMessage<T>
public void subscribe(org.reactivestreams.Subscriber<? super T> subscriber)
StreamMessage
Subscriber
.subscribe
in interface StreamMessage<T>
subscribe
in interface org.reactivestreams.Publisher<T>
public void subscribe(org.reactivestreams.Subscriber<? super T> subscriber, java.util.concurrent.Executor executor)
StreamMessage
Subscriber
from the specified
Executor
.subscribe
in interface StreamMessage<T>
public void abort()
StreamMessage
Subscription
if any and closes this publisher.abort
in interface StreamMessage<T>
public java.util.concurrent.CompletableFuture<java.lang.Void> closeFuture()
StreamMessage
CompletableFuture
that completes when this publisher is complete,
either successfully or exceptionally.closeFuture
in interface StreamMessage<T>