Package io.helidon.common.reactive
Interface Flow.Publisher<T>
-
- Type Parameters:
T
- the published item type
- All Known Subinterfaces:
Content
,Flow.Processor<T,R>
,Multi<T>
,Single<T>
,Subscribable<T>
- All Known Implementing Classes:
OriginThreadPublisher
,OutputStreamPublisher
,ReadableByteChannelPublisher
,SubmissionPublisher
- Enclosing class:
- Flow
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public static interface Flow.Publisher<T>
A producer of items (and related control messages) received by Subscribers. Each currentFlow.Subscriber
receives the same items (via methodonNext
) in the same order, unless drops or errors are encountered. If a Publisher encounters an error that does not allow items to be issued to a Subscriber, that Subscriber receivesonError
, and then receives no further messages. Otherwise, when it is known that no further messages will be issued to it, a subscriber receivesonComplete
. Publishers ensure that Subscriber method invocations for each subscription are strictly ordered in happens-before order.Publishers may vary in policy about whether drops (failures to issue an item because of resource limitations) are treated as unrecoverable errors. Publishers may also vary about whether Subscribers receive items that were produced or available before they subscribed.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
subscribe(Flow.Subscriber<? super T> subscriber)
Adds the given Subscriber if possible.
-
-
-
Method Detail
-
subscribe
void subscribe(Flow.Subscriber<? super T> subscriber)
Adds the given Subscriber if possible. If already subscribed, or the attempt to subscribe fails due to policy violations or errors, the Subscriber'sonError
method is invoked with anIllegalStateException
. Otherwise, the Subscriber'sonSubscribe
method is invoked with a newFlow.Subscription
. Subscribers may enable receiving items by invoking therequest
method of this Subscription, and may unsubscribe by invoking itscancel
method.- Parameters:
subscriber
- the subscriber- Throws:
NullPointerException
- if subscriber is null
-
-