The Flow.Processor interface can serve as both Subscriber and Publisher. The implementation is provided here:
static interface Flow.Processor<T,R> extends Flow.Subscriber<T>, Flow.Publisher<R>
This interface takes two arguments—the subscribed item type <T> and the published item type <R>. It does not have its own methods, but does inherit the following method from java.util.concurrent.Flow.Publisher:
void subscribe(Flow.Subscriber<? super T> subscriber)
Flow.Processor also inherits the following methods from java.util.concurrent.Flow.Subscriber interface:
- void onComplete()
- void onError(Throwable throwable)
- void onNext(T item)
- void onSubscribe(Flow.Subscription subscription)