In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Reactive which Streams specifications, many novices are not very clear, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
1) what is Reactive Streams:
Reactive Streams is an initiative to provide a standard for asynchronous stream processing with non-blocking back pressure. This encompasses efforts aimed at runtime environments (JVM and JavaScript) as well as network protocols.
In a nutshell, Reactive Streams is a specification for "asynchronous flow processing with a non-blocking backpressure mechanism". It's a simple definition, but it's not easy to understand asynchronism and non-blocking correctly. I'll write a separate article later. In fact, the Reactive Streams specification or its third-party code implementation is richer: in addition to non-blocking, there are: Composable, Deferred, Flow Controll, Resilient, Interruptible.
Among them, Composable is the opportunity to display the talent of functional programming ideas. You can understand the parameters of various Stream API operators in Java8, so Lamda expression is the basic premise of Reactive Streams implementation, otherwise it is difficult to imagine a bloated object-oriented Composable. With the groundwork of JDK8, it is possible that the Reactive Streams interface is defined by JDK9 in Flow.
As of August 23rd, 2019 we have released version 1.0.3 of Reactive Streams for the JVM, including Java API, a textual Specification, a TCK and implementation examples.
The specification consists of three parts: Java API (org.reactive-streams), the specification described in words, and the technology compatibility toolkit.
The Reactive Streams specification is limited to the Java (JavaScript, network protocol) world. Although other languages also have tools like Reactive (see here: ReactiveX), there seems to be no similar specification.
2) Why should there be Reactive Streams
Because many vendors have developed reactive libraries, but they are directly difficult / impossible to interoperate. Specification with Reactive Streams makes them interoperable, which makes it possible for them to string together to form a reactive chain.
3) Why use Reactive
Because reactive can drain CPU..., it saves money from the boss's point of view, electricity from the environmental point of view, and interesting from the programmer's point of view.
4) RxJava, a world-famous Reactive library in Java
From the Reactive Manifesto to the Reactive Streams specification to various Reactive libraries is a natural thread. But the reality is that we first have the idea of Reactive system, smart programs to develop a variety of libraries containing reactive ideas (such as RxJava 1.0). For the unity and maneuverability of each library, we negotiate the Reactive Streams specification together. Then these existing reactive libraries improve their API design, move closer to the reactive streams specification and provide a variety of conversion api for users to convert directly in the native api and reactive streams interfaces. For example, Flowable of RxJava 2.0 inherits directly from org.reactive-streams.Publisher and provides toObservable () toFlowable (). Because the implementation details of each library are different, you need to refer to its manual when using a specific transformation api.
Although RxJava is the leader in java ractive programming, RxJava is basically equivalent to Project Reactor 3.0. But given the strength of Spring's ecology, it is estimated that its future will not be too bright.
JDK
The API form definition of this specification begins with the version of JDK 9 and is defined as a static subclass of java.util.concurrent.Flow. In fact, since you already have a specification like org.reactive-streams, why create a Flow in JDK to redefine it again. Is it meant to declare that JDK itself has something that supports reactive streams?
The original intention of this idea should be like the JDBC interface, let the interface defined in Flow become SPI, and make the reactive sreams of different vendors interoperable. So what is defined in Flow in JDK is not a library, but a SPI:Service Provider Interface.
Vert.x, MongoDB responsive stream driver
These have been improved to conform to the API definition in org.reactive-streams. Vert.x provides not only the reactive library for java, but also JavaScritp, Ruby, Scala and so on.
Project Reactor of Spring
Https://projectreactor.io/docs/core/release/reference/
Now that Spring provides an implementation of Reactive Streams, it feels like the libraries listed above don't make much sense. The details of the implementation of the Reactive Streams specification vary greatly, because the ecology of Spring is too strong, if there are no special requirements, such as JDK less than 8, then our project is basically based on Project Reactor, then it should be a better choice. This web page https://tech.io/playgrounds/929/reactive-programming-with-reactor-3/Intro can help you practice Reactor Api.
Project Reactor has experienced 1.0,2.0,3.3 so far. There is no Reactive Stream specification at stage 1. 0. The follow specification began in 2. 0 and was basically finalized. 3. 0 feels like a reconstructed version, forming a reactive-streams-commons library. Here is the release document for 3. 0: https://github.com/reactor/reactor-core/releases?after=v3.0.0.RELEASE.
With a basic library such as Project Reactor, the whole Spring component basically has a version of Reactive Style. On this basis, you can use Netty (or Servet 3.1 Containe) + Reactive Streams adaptation layer + Spring Security Reactive + WebFlux + Spring Data Reactive Repository to build a Reactive application from beginning to end.
From the component point of view of Spring Cloud, Reactive Discovery Client, Reactive Load Balancer, Blockhound, Reactor Debug, Improved Reactor Micrometer Support, Reactor Netty Metric...
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.