Scala Reactive Programming
上QQ阅读APP看书,第一时间看更新

Flow API – Processor

In the Flow API, Processor is a special kind of component. It works as both a Subscriber and Publisher. We can use it as a source of data, that is, a Publisher, or a destination of data, that is, a Subscriber.

In the Java 9 Flow API, this Processor is an interface with no methods and is defined like this:

public interface Processor<T,R> extends Subscriber<T>, Publisher<R> {   
}  

It is also defined within another class as a static component. We will see it in the next section.