Package io.servicetalk.concurrent.api
Interface PublisherOperator<T,R>
- Type Parameters:
T- Type of items emitted by thePublisherthis operator is applied.R- Type of items emitted by this operator.
- All Superinterfaces:
Function<PublisherSource.Subscriber<? super R>,PublisherSource.Subscriber<? super T>>
- All Known Implementing Classes:
FramedDeserializerOperator
- 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 interface PublisherOperator<T,R>
extends Function<PublisherSource.Subscriber<? super R>,PublisherSource.Subscriber<? super T>>
An operator contract for a
Publisher.
Logically an operator sits between a Publisher and a PublisherSource.Subscriber and hence it has two
responsibilities:
- Subscribe to the
Publisheron which this operator is applied. - Accept a
PublisherSource.Subscriberthat subscribes to this operator.
Function that takes a PublisherSource.Subscriber and returns a
PublisherSource.Subscriber. The PublisherSource.Subscriber that is passed to this Function is the one that has subscribed to
this operator. The PublisherSource.Subscriber that is returned by this Function is the one that should be used to
subscribe to the Publisher on which this operator is applied.-
Method Summary
Modifier and TypeMethodDescriptionPublisherSource.Subscriber<? super T>apply(PublisherSource.Subscriber<? super R> subscriber) Implementation of this operator.
-
Method Details
-
apply
Implementation of this operator. SeePublisherOperatorfor definition of an operator.- Specified by:
applyin interfaceFunction<T,R> - Parameters:
subscriber-PublisherSource.Subscriberthat subscribed to this operator.- Returns:
PublisherSource.Subscriberthat is used to subscribe to thePublisherthat this operator is applied to.
-