Object
TransformPublisher<T,R>
- Type Parameters:
T
- input type (type of a Publisher)R
- output type (type of an existing Subscriber)
- All Implemented Interfaces:
Flow.Publisher<R>
Transformer
Flow.Publisher
allows to subscribe existing Flow.Subscriber
of type R to a
Flow.Publisher
of type T.
The transformation of items from T to R is done with a transformer Function
This publisher class is based on TransformSubscriber
and every subscribe(Subscriber)
call it wraps into TransformSubscriber
and then subscribes it to
the target publisher.
-
Constructor Summary
ConstructorDescriptionTransformPublisher
(Flow.Publisher<T> targetPublisher, Function<T, Optional<R>> transformer) -
Method Summary
-
Constructor Details
-
TransformPublisher
- Parameters:
transformer
- Transforms input messages from the targetFlow.Publisher
and publishes them to subscribers. If transformer returns empty message it will be ignored and not published.
-
-
Method Details
-
subscribe
- Specified by:
subscribe
in interfaceFlow.Publisher<T>
-