Reactor Netty-响应式编程-010

 🤗 ApiHug × {Postman|Swagger|Api...} = 快↑ 准√ 省↓

  1. GitHub - apihug/apihug.com: All abou the Apihug   
  2. apihug.com: 有爱,有温度,有质量,有信任
  3. ApiHug - API design Copilot - IntelliJ IDEs Plugin | Marketplace

api-hug-contact

为什么不直接上来就 Netty 或者 Spring WebFlux ?

出于几点考虑:

  1. 本身 Netty 学习曲线稍微陡峭
  2. Spring WebFlux 封装很多细节

所以选择一个 Reactor --> Reactor Netty --> Spring WebFlux 这样一个渐进的线路。

Reactor Netty 官方文档open in new window,最新资料参考官网更新, 学习例子: reactor-netty-demo 学习open in new window。

#关于

Suited for Microservices Architecture, Reactor Netty offers backpressure-ready network engines for HTTP (including Websockets), TCP, and UDP.

适合于微服务架构,Reactor Netty为HTTP(包括Websocket),TCP和UDP提供了支持背压的网络引擎。

#前提

Reactor Netty需要运行在Java 8 及以上的版本上。

它需要依赖于以下组件:

  1. Reactive Streams v1.0.4
  2. Reactor Core v3.x
  3. Netty v4.1.x

#项目依赖

都走BOM 走了非常简单:

dependencies {
  // import a BOM
  implementation platform('io.projectreactor:reactor-bom:2020.0.21') 

  // define dependencies without versions
  implementation 'io.projectreactor.netty:reactor-netty-core' 
  implementation 'io.projectreactor.netty:reactor-netty-http'
}

依赖关系如下:

------------------------------------------------------------
| BOM 依赖
------------------------------------------------------------
+--- io.projectreactor:reactor-bom:2020.0.21
|    +--- io.projectreactor.netty:reactor-netty-core:1.0.21 (c)
|    +--- io.projectreactor.netty:reactor-netty-http:1.0.21 (c)
|    +--- io.projectreactor:reactor-core:3.4.21 (c)
|    \--- org.reactivestreams:reactive-streams:1.0.4 (c)
------------------------------------------------------------
| 下面是具体版本
------------------------------------------------------------
+--- io.projectreactor.netty:reactor-netty-core -> 1.0.21
|    +--- io.netty:netty-handler:4.1.79.Final
|    |    +--- io.netty:netty-common:4.1.79.Final
|    |    +--- io.netty:netty-resolver:4.1.79.Final
|    |    |    \--- io.netty:netty-common:4.1.79.Final
|    |    +--- io.netty:netty-buffer:4.1.79.Final
|    |    |    \--- io.netty:netty-common:4.1.79.Final
|    |    +--- io.netty:netty-transport:4.1.79.Final
|    |    |    +--- io.netty:netty-common:4.1.79.Final
|    |    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    |    \--- io.netty:netty-resolver:4.1.79.Final (*)
|    |    +--- io.netty:netty-transport-native-unix-common:4.1.79.Final
|    |    |    +--- io.netty:netty-common:4.1.79.Final
|    |    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    |    \--- io.netty:netty-transport:4.1.79.Final (*)
|    |    \--- io.netty:netty-codec:4.1.79.Final
|    |         +--- io.netty:netty-common:4.1.79.Final
|    |         +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |         \--- io.netty:netty-transport:4.1.79.Final (*)
|    +--- io.netty:netty-handler-proxy:4.1.79.Final
|    |    +--- io.netty:netty-common:4.1.79.Final
|    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    +--- io.netty:netty-transport:4.1.79.Final (*)
|    |    +--- io.netty:netty-codec:4.1.79.Final (*)
|    |    +--- io.netty:netty-codec-socks:4.1.79.Final
|    |    |    +--- io.netty:netty-common:4.1.79.Final
|    |    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    |    +--- io.netty:netty-transport:4.1.79.Final (*)
|    |    |    \--- io.netty:netty-codec:4.1.79.Final (*)
|    |    \--- io.netty:netty-codec-http:4.1.79.Final
|    |         +--- io.netty:netty-common:4.1.79.Final
|    |         +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |         +--- io.netty:netty-transport:4.1.79.Final (*)
|    |         +--- io.netty:netty-codec:4.1.79.Final (*)
|    |         \--- io.netty:netty-handler:4.1.79.Final (*)
|    +--- io.netty:netty-resolver-dns:4.1.79.Final
|    |    +--- io.netty:netty-common:4.1.79.Final
|    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    +--- io.netty:netty-resolver:4.1.79.Final (*)
|    |    +--- io.netty:netty-transport:4.1.79.Final (*)
|    |    +--- io.netty:netty-codec:4.1.79.Final (*)
|    |    +--- io.netty:netty-codec-dns:4.1.79.Final
|    |    |    +--- io.netty:netty-common:4.1.79.Final
|    |    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    |    +--- io.netty:netty-transport:4.1.79.Final (*)
|    |    |    \--- io.netty:netty-codec:4.1.79.Final (*)
|    |    \--- io.netty:netty-handler:4.1.79.Final (*)
|    +--- io.netty:netty-resolver-dns-native-macos:4.1.79.Final
|    |    \--- io.netty:netty-resolver-dns-classes-macos:4.1.79.Final
|    |         +--- io.netty:netty-common:4.1.79.Final
|    |         +--- io.netty:netty-resolver-dns:4.1.79.Final (*)
|    |         \--- io.netty:netty-transport-native-unix-common:4.1.79.Final (*)
|    +--- io.netty:netty-transport-native-epoll:4.1.79.Final
|    |    +--- io.netty:netty-common:4.1.79.Final
|    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    +--- io.netty:netty-transport:4.1.79.Final (*)
|    |    +--- io.netty:netty-transport-native-unix-common:4.1.79.Final (*)
|    |    \--- io.netty:netty-transport-classes-epoll:4.1.79.Final
|    |         +--- io.netty:netty-common:4.1.79.Final
|    |         +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |         +--- io.netty:netty-transport:4.1.79.Final (*)
|    |         \--- io.netty:netty-transport-native-unix-common:4.1.79.Final (*)
|    \--- io.projectreactor:reactor-core:3.4.20 -> 3.4.21
|         \--- org.reactivestreams:reactive-streams:1.0.4
------------------------------------------------------------
| HTTP
------------------------------------------------------------
+--- io.projectreactor.netty:reactor-netty-http -> 1.0.21
|    +--- io.netty:netty-codec-http:4.1.79.Final (*)
|    +--- io.netty:netty-codec-http2:4.1.79.Final
|    |    +--- io.netty:netty-common:4.1.79.Final
|    |    +--- io.netty:netty-buffer:4.1.79.Final (*)
|    |    +--- io.netty:netty-transport:4.1.79.Final (*)
|    |    +--- io.netty:netty-codec:4.1.79.Final (*)
|    |    +--- io.netty:netty-handler:4.1.79.Final (*)
|    |    \--- io.netty:netty-codec-http:4.1.79.Final (*)
|    +--- io.netty:netty-resolver-dns:4.1.79.Final (*)
|    +--- io.netty:netty-resolver-dns-native-macos:4.1.79.Final (*)
|    +--- io.netty:netty-transport-native-epoll:4.1.79.Final (*)
|    +--- io.projectreactor.netty:reactor-netty-core:1.0.21 (*)
|    \--- io.projectreactor:reactor-core:3.4.20 -> 3.4.21 (*)

#参考

  1. Reactor Netty 官方文档open in new window
  2. reactor-netty-demo 学习open in new window
  3. Reactor Netty Workshopopen in new window
  4. reactor-netty API

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/583698.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Objective-C大爆炸:从零到单例模式

oc学习笔记(一) 文章目录 oc学习笔记(一)oc与c语言的区别#import的用法foundation框架NSLog函数NSString类型符号的作用oc中的数据类型 类与对象概念: 创建第一个类类的定义类的实现类加载对象的产生和使用 self语法id…

GaussDB数据库事务管理

一、引言 事务管理是数据库系统中至关重要的一部分,它确保了数据库的一致性和可靠性。在GaussDB数据库中,事务管理不仅遵循传统的ACID特性,还提供了一些高级功能。本文将深入探讨GaussDB数据库事务管理的各个方面。 二、事务的基本概念 2.1…

前端页面单元测试最佳策略:全面涵盖逻辑、组件、流程、UI及性能优化测试,全面保障软件应用的质量

页面级别的测试要求我们从更宏观的角度审视应用,不仅关注单个组件的正确性,还要确保组件间的协作无误,以及用户在应用中的完整体验。通过集成测试、E2E测试和场景测试,我们可以更全面地覆盖应用的各种使用情况,提高软件…

Educational Codeforces Round 165 (Rated for Div. 2) (C、D)

1969C - Minimizing the Sum 题意: 思路:观察到操作数很小,最值问题操作数很容易想到dp,用表示第个元素,操作了次的最小值总和,转移的时候枚举连续操作了几次即可,而连续操作了几次即将全部变成…

机器学习:基于Sklearn、XGBoost框架,使用逻辑回归、支持向量机和XGBClassifier来诊断并预测一个人是否患有自闭症

前言 系列专栏:机器学习:高级应用与实践【项目实战100】【2024】✨︎ 在本专栏中不仅包含一些适合初学者的最新机器学习项目,每个项目都处理一组不同的问题,包括监督和无监督学习、分类、回归和聚类,而且涉及创建深度学…

Linux硬盘挂载操作记录

文章目录 1.前置概念2.挂载步骤2.1查看盘信息2.2挂载整个盘到指定目录2.3将盘划分为多个分区并挂载到不同目录2.3.1创建分区2.3.2指定文件系统2.3.3挂载目录 3.删除分区 1.前置概念 分区:分区就是将硬盘划分为多个区域,每个区域都有自己的文件系统&…

AI智能名片商城小程序:引领企业迈向第三增长极

随着数字化浪潮的席卷,私域流量的重要性逐渐凸显,为企业增长提供了全新的动力。在这一背景下,AI智能名片商城系统崭露头角,以其独特的优势,引领企业迈向第三增长极。 私域流量的兴起,为企业打开了一扇新的销…

竞赛 基于机器视觉的二维码识别检测 - opencv 二维码 识别检测 机器视觉

文章目录 0 简介1 二维码检测2 算法实现流程3 特征提取4 特征分类5 后处理6 代码实现5 最后 0 简介 🔥 优质竞赛项目系列,今天要分享的是 基于机器学习的二维码识别检测 - opencv 二维码 识别检测 机器视觉 该项目较为新颖,适合作为竞赛课…

迅为RK3568开发板瑞芯微人工智能AI鸿蒙Linux安卓开发学习

PU:iTOP-3568开发板采用瑞芯微RK3568处理器,内部集成了四核64位Cortex-A55处理器。主频高达2.0Ghz,RK809动态调频。集成了双核心架构GPU,ARM G52 2EE、支持OpenGL ES1.1/2.0/3.2、OpenCL2.0、Vulkan1.1、内嵌高性能2D加速硬件。 内…

Windows Server 评估版转换(升级)为完整版

临时方法 获取 Windows Server 的剩余宽限期 Slmgr /dliWindows Server免费试用期可以使用以下命令合法延长5次,共180天: slmgr /rearm这意味着所评估的 Windows Server 的最长可用时间为 3 年 ( 180 days * 6)。 试用期到期后,Windows S…

使用opencv改变图片大小

使用opencv改变图片大小 图片的宽度和高度效果代码 图片的宽度和高度 宽度:图片的宽度指的是图像从左边缘到右边缘的水平跨度。在数字图像中,宽度通常是以像素(pixels)为单位来度量的。高度:图片的高度指的是图像从上…

在远程服务器上安装anaconda以及配置pytorch虚拟环境

目录 第一步:官网或者清华源下载Anaconda。 第二步:创建虚拟环境。 第三步:在服务器终端输入nvidia-smi查看服务器信息。 第四步:在pytorch官网找到对应版本cuda的命令。 第一步:官网或者清华源下载Anaconda。 官网…

Hive 表定义主键约束

文章目录 1.建表语句2.主键约束3.主键约束的意义参考文献 1.建表语句 先看一下官方给的完整的见表语句: CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name -- (Note: TEMPORARY available in Hive 0.14.0 and later)[(col_name data…

谷歌浏览器查看http请求的请求标头和响应标头

http://t.weather.itboy.net/api/weather/city/101010100 记得刷新,才算请求了一次服务器 响应标头: HTTP/1.1 200 OK Content-Type: application/json; 请求标头: GET /api/weather/city/101010100 HTTP/1.1 Host: t.weather.itboy.n…

清新优雅、功能强大的后台管理模板 | 开源日报 No.238

soybeanjs/soybean-admin Stars: 7.0k License: MIT soybean-admin 是一个基于 Vue3、Vite5、TypeScript、Pinia、NaiveUI 和 UnoCSS 的清新优雅且功能强大的后台管理模板。 使用最新流行的技术栈,如 Vue3、Vite5 和 TypeScript。采用清晰的项目架构,易…

基于Spring Boot的体质测试数据分析及可视化系统设计与实现

基于Spring Boot的体质测试数据分析及可视化系统的设计与实现 开发语言:Java框架:springbootJDK版本:JDK1.8数据库工具:Navicat11开发软件:eclipse/myeclipse/idea 系统部分展示 前台首页界面图,体质测试…

【酱浦菌-爬虫项目】python爬取彼岸桌面壁纸

首先,代码导入了两个库:requests和parsel。这些库用于处理HTTP请求和解析HTML内容。 然后,它定义了一个变量url,指向网站’樱花2024年4月日历风景桌面壁纸_高清2024年4月日历壁纸_彼岸桌面’。 接下来,设置了一个HTT…

头歌:Spark的安装与使用

第1关:Scala语言开发环境的部署 相关知识 Scala是一种函数式面向对象语言,它融汇了许多前所未有的特性,而同时又运行于JVM之上。随着开发者对Scala的兴趣日增,以及越来越多的工具支持,无疑Scala语言将成为你手上一件…

Django框架之ORM操作

一、选择数据库 1、默认数据库 Django默认的数据库是sqlite3数据库 DATABASES {default: {ENGINE: django.db.backends.sqlite3,NAME: BASE_DIR / db.sqlite3,} }2、指定数据库 修改连接到MySQL数据库 DATABASES {default: {ENGINE: django.db.backends.mysql,# 数据库名…

微信小程序 request 配置了服务器域名后 发布体验版无法访问

问题描述 在微信小程序公众平台配置了测试服务器域名后,发布了体验版进行测试,发现网络请求不通,打开调试也依然无法访问。 解决步骤: 1.首先根据小程序文档网络模块的使用说明,一步步排查域名证书是否符合规范&…