Reactive Stream Specification
The Reactive Streams specification defines a standard for asynchronous stream processing with non-blocking back pressure in Java. It establishes a set of interfaces that enable interoperability between different reactive libraries, including those used in Spring.
For more details visit: https://github.com/reactive-streams/reactive-streams-jvm?tab=readme-ov-file#specification
Reactive Streams introduces four main interfaces:
Publisher: The Publisher interface represents a provider of a potentially unbounded number of sequenced elements, publishing them asynchronously. Publishers can emit items to one or more subscribers, adhering to the backpressure signal.
Subscriber: The Subscriber interface represents a consumer of a potentially unbounded number of sequenced elements. Subscribers receive elements emitted by a Publisher and process them accordingly. Subscribers can also signal demand to Publishers, managing the flow of data and implementing backpressure.
Subscription: The Subscription interface represents the relationship between a Publisher and a Subscriber. It allows a Subscriber to signal how many elements it is ready to consume from the Publisher at a time. Additionally, it enables a Subscriber to cancel the flow of elements if necessary.
Processor: The Processor interface represents a processing stage—which is both a Subscriber and a Publisher. It receives elements from a preceding Publisher, processes them in some way, and then publishes the processed elements to subsequent Subscribers. Processors can be used to build complex data processing pipelines.
Last updated
Was this helpful?