Reactive响应式编程Spring webFlux

作者: jekkay 分类: java,默认 发布时间: 2019-04-22 11:25

Reactive响应式编程


1. 概念

响应式编程的概念,有很多种定义,我摘录部分如下:

  • Reactive编程是一种通过将智能路由和事件消费组合起来改变行为的微架构风格
  • Reactive响应式(反应式)编程 是一种新的编程风格,其特点是异步或并发、事件驱动、推送PUSH机制以及观察者模式的衍生。
  • Reactive 是异步非阻塞编程;Reactive 能够提升程序性能;Reactive 解决传统编程模型遇到的困境
  • Reactive programming is a declarative programming paradigm concerned with data streams and the propagation of change. With this paradigm it is possible to express static (e.g. arrays) or dynamic (e.g. event emitters) data streams with ease, and also communicate that an inferred dependency within the associated execution model exists, which facilitates the automatic propagation of the changed data flow.

我的简单理解就是,可以将事件的消费可以异步委托给耦合性比较强消费者来处理。不管请求的响应,还是结果的反馈都可以认为事件主动或者被动被给相应的消费者,这种响应式编程方式可以带来极大的性能提高,具体可以参考http://www.reactive-streams.org/

http://www.easysb.cn/2019/04/292.html

2. 几篇介绍文字

3. Spring中的Reactive技术栈

  • [https://spring.io/] (https://spring.io/)

Spring Boot 2.0提供了Reactive Statck的编程Spring WebFlux。以下摘自官网描述:

evelopers are constantly challenged with choosing the most effective runtime, programming model, and architecture for their application’s requirements and team’s skill set. For example, some use cases are best handled by a technology stack based on synchronous blocking I/O architecture, whereas others would be better served by an asynchronous, nonblocking stack built on the reactive design principles described in the Reactive Streams Specification.

Reactive Spring represents a platform-wide initiative to deliver reactive support at every level of the development stack: web, security, data, messaging, etc. Spring Framework 5 delivers on this vision by providing a new reactive web stack called Spring WebFlux, which is offered side by side with the traditional Spring MVC web stack.

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据