Package io.servicetalk.concurrent.api
Interface PublisherToSingleOperator<T,R>
-
- Type Parameters:
T
- Type of items emitted by thePublisher
this operator is applied.R
- Type of items emitted by this operator.
- All Superinterfaces:
java.util.function.Function<SingleSource.Subscriber<? super R>,PublisherSource.Subscriber<? super T>>
public interface PublisherToSingleOperator<T,R> extends java.util.function.Function<SingleSource.Subscriber<? super R>,PublisherSource.Subscriber<? super T>>
An operator contract for aPublisher
toSingle
conversion. Logically an operator sits between aPublisher
and aPublisherSource.Subscriber
and hence it has two responsibilities:- Subscribe to the
Publisher
on which this operator is applied. - Accept a
SingleSource.Subscriber
which is converted to aPublisherSource.Subscriber
that subscribes to this operator.
Function
that takes aSingleSource.Subscriber
and returns aPublisherSource.Subscriber
. TheSingleSource.Subscriber
that is passed to thisFunction
is the one that has subscribed to theSingle
operator. ThePublisherSource.Subscriber
that is returned by thisFunction
is the one that should be used to subscribe to thePublisher
on which this operator is applied.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PublisherSource.Subscriber<? super T>
apply(SingleSource.Subscriber<? super R> subscriber)
Implementation of this operator.
-
-
-
Method Detail
-
apply
PublisherSource.Subscriber<? super T> apply(SingleSource.Subscriber<? super R> subscriber)
Implementation of this operator. SeePublisherToSingleOperator
for definition of an operator.- Specified by:
apply
in interfacejava.util.function.Function<T,R>
- Parameters:
subscriber
-SingleSource.Subscriber
that subscribed to this operator.- Returns:
PublisherSource.Subscriber
that is used to subscribe to thePublisher
that this operator is applied to.
-
-