#yyds干货盘点#Project Reactor

当筵意气临九霄,星离雨散不终朝。这篇文章主要讲述#yyds干货盘点#Project Reactor相关的知识,希望能为你提供帮助。
Operators - Publisher / Subscriber

  • Nothing Happens Until You subscribe()
  • Flux [ 0..N ] - onNext()、onComplete()、onError()
  • Mono [ 0..1 ] - onNext()、onComplete()、onError()
Backpressure
  • Subscription
  • onRequest()、onCancel()、onDispose()
线程调度 Schedulers
  • immediate() / single() / newSingle()
  • elastic() / parallel() / newParallel()
【#yyds干货盘点#Project Reactor】错误处理
  • onError / onErrorReturn / onErrorResume
  • doOnError / doFinally
1、pom
< ?xml version="1.0" encoding="UTF-8"?>
< project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
< modelVersion> 4.0.0< /modelVersion>
< parent>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter-parent< /artifactId>
< version> 2.1.2.RELEASE< /version>
< relativePath/> < !-- lookup parent from repository -->
< /parent>
< groupId> com.zhz< /groupId>
< artifactId> reactor-spring-bootsimple-reactor-demo< /artifactId>
< version> 0.0.1-SNAPSHOT< /version>
< name> reactor-spring-bootsimple-reactor-demo< /name>
< description> Spring Boot集成reactor< /description>
< properties>
< java.version> 1.8< /java.version>
< /properties>
< dependencies>
< dependency>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter< /artifactId>
< /dependency>
< dependency>
< groupId> org.projectlombok< /groupId>
< artifactId> lombok< /artifactId>
< /dependency>
< dependency>
< groupId> io.projectreactor< /groupId>
< artifactId> reactor-core< /artifactId>
< /dependency>
< dependency>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-starter-test< /artifactId>
< scope> test< /scope>
< /dependency>
< /dependencies>

< build>
< plugins>
< plugin>
< groupId> org.springframework.boot< /groupId>
< artifactId> spring-boot-maven-plugin< /artifactId>
< /plugin>
< /plugins>
< /build>

< /project>

2、测试代码
package com.zhz.reactor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Scheduler;
import reactor.

    推荐阅读