Reactive Streams

Reactive Streams provide a protocol or rule for asynchronous stream processing with non-blocking back-pressure. This standard is also adopted by Java 9 in the form of java.util.concurrent.Flow. Reactive Streams is composed of four simple Java interfaces. These interfaces are Publisher, Subscriber, Subscription, and Processor. But the main goal of the Reactive Streams is handling the backpressure. As discussed earlier, backpressure is a process that allows a receiver to ask about a data quantity from the emitter.

You can use the following Maven dependency for adding Reactive Streams in your application development:

    <dependency> 
      <groupId>org.reactivestreams</groupId> 
      <artifactId>reactive-streams</artifactId> 
      <version>1.0.1</version> 
   </dependency> 
   <dependency> 
      <groupId>org.reactivestreams</groupId> 
      <artifactId>reactive-streams-tck</artifactId> 
      <version>1.0.1</version> 
   </dependency> 

The preceding Maven dependency code adds the required libraries for the Reactive Streams in your application. In the upcoming section, we'll see how Spring implements Reactive Streams in the web module of Spring and the Spring MVC Framework.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset