In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the life cycle of web responsive flow". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the life cycle of web responsive flow".
Generally speaking, there are three stages. Assembly time, subscription time, run time. The assembly time is the static expression of the code, and the subscription time and runtime describe the logic designed when the responsive stream program is running.
When assembling
This stage is the stage when we build the processing model. Basically solved the following three aspects of the problem.
1) define what the data source of this reactive stream is. Publisher
At this stage, we set up the data source by using methods such as just (), range (), fromArray (), push (), create (), generate (), etc.
2) who is the final subscriber to this data stream? Subscriber
On the upstream publisher, we pass the subscriber from downstream to upstream to the upstream publisher containing the data source by calling the subscribe () method.
3) what conversion and processing needs to be done when the data reaches the final subscriber? Operator
The above two calls solve the problem of where the data comes from and by whom it is finally received. However, in the process of data being transferred from upstream to downstream, we often need to do all kinds of data processing. At this stage, all kinds of operator show their skills, such as map (), flatMap (), filter (), reduce (), scan (), concatMap (), usingWhen (). ...
In fact, every time you experience an operator, a new intermediate level of publisher is generated, which is the immutability of reactive stream.
The assembly is basically the part of the static logic defined by the code we write.
When the program is running, it will enter the following two stages: subscription time and run time, so these two stages are the dynamic performance of the program.
When subscribing
By assembling, we define what data (publisher) is processed (operator) and to whom (subscriber) is finally passed. At this stage of subscription, the problem solved is how to pass the incoming subscriber when calling the downstream publisher to the upstream publisher in turn. It is conceivable that Project Reactor passes the subscriber sequentially after encapsulation rather than directly passing the downstream subscriber, because each publisher concatenated with operator needs its own subscriber. You can understand the concept of "Subscriber chain" here.
This delivery process is important because onSubscribe (Subscription s) in subscriber provides a mechanism for upstream publisher to pass Subscription to downstream Subscriber.
Because Subscriber can start the flow of data only through the request method of subsciption.
Run time
At the time of assembly and subscription, the data flow is already "on the trigger". We just need to call the request () method through the Subscription passed to us upstream to trigger the flow of data.
By passing different numbers to Subscription's request () when Subscirberd's onSubscription () and onNext () are called back, we can implement pull model, push model, and pull-push model, respectively.
In a narrow sense, the so-called runtime of responsive flow is the signal exchange between Publisher and Subscriber. In a broad sense, it also includes all kinds of data conversion and processing by operator.
Thank you for reading, the above is the content of "what is the life cycle of web responsive flow". After the study of this article, I believe you have a deeper understanding of what the life cycle of web responsive flow is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.