Hands-On Reactive Programming in Spring 5
Oleh Dokuka Igor Lozynskyi更新时间:2021-07-23 16:37:22
最新章节:Leave a review - let other readers know what you think封面
Title Page
Copyright and Credits
Hands-On Reactive Programming in Spring 5
Dedication
Packt Upsell
Why subscribe?
Packt.com
Foreword
Contributors
About the authors
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Why Reactive Spring?
Why reactive?
Message-driven communication
Reactivity use cases
Why Reactive Spring?
Reactivity on the service level
Summary
Reactive Programming in Spring - Basic Concepts
Early reactive solutions in Spring
Observer pattern
Observer pattern usage example
Publish-Subscribe pattern with @EventListener
Building applications with @EventListener
Bootstrapping a Spring application
Implementing business logic
Asynchronous HTTP with Spring Web MVC
Exposing the SSE endpoint
Configuring asynchronous support
Building a UI with SSE support
Verifying application functionality
Criticism of the solution
RxJava as a reactive framework
Observer plus iterator equals Reactive Stream
Producing and consuming streams
Generating an asynchronous sequence
Stream transformation and marble diagrams
Map operator
Filter operator
Count operator
Zip operator
Prerequisites and benefits of RxJava
Rebuilding our application with RxJava
Implementing business logic
Custom SseEmitter
Exposing the SSE endpoint
Application configuration
Brief history of reactive libraries
Reactive landscape
Summary
Reactive Streams - the New Streams' Standard
Reactivity for everyone
The API's inconsistency problem
Pull versus push
The flow control problem
Slow producer and fast consumer
Fast producer and slow consumer
Unbounded queue
Bounded drop queue
Bounded blocking queue
The solution
The basics of the Reactive Streams spec
Reactive Streams spec in action
The introduction of the Processor notion
Reactive Streams technology compatibility kit
The Publisher verification
The Subscriber verification
JDK 9
Advanced - async and parallel in Reactive Streams
Transfiguration of the Reactive Landscape
RxJava transfiguration
Vert.x adjustments
Ratpack improvements
MongoDB Reactive Streams driver
A composition of reactive technologies in action
Summary
Project Reactor - the Foundation for Reactive Apps
A brief history of Project Reactor
Project Reactor version 1.x
Project Reactor version 2.x
Project Reactor essentials
Adding Reactor to the project
Reactive types – Flux and Mono
Flux
Mono
Reactive types of RxJava 2
Observable
Flowable
Single
Maybe
Completable
Creating Flux and Mono sequences
Subscribing to Reactive Streams
Implementing custom subscribers
Transforming reactive sequences with operators
Mapping elements of reactive sequences
Filtering reactive sequences
Collecting reactive sequences
Reducing stream elements
Combining Reactive Streams
Batching stream elements
The flatMap concatMap and flatMapSequential operators
Sampling elements
Transforming reactive sequences into blocking structures
Peeking elements while sequence processing
Materializing and dematerializing signals
Finding an appropriate operator
Creating streams programmatically
Factory methods – push and create
Factory method – generate
Wrapping disposable resources into Reactive Streams
Wrapping reactive transactions with the usingWhen factory
Handling errors
Backpressure handling
Hot and cold streams
Multicasting elements of a stream
Caching elements of a stream
Sharing elements of a stream
Dealing with time
Composing and transforming Reactive Streams
Processors
Testing and debugging Project Reactor
Reactor Addons
Advanced Project Reactor
Reactive Streams life cycle
Assembly-time
Subscription-time
Runtime
The thread scheduling model in Reactor
The publishOn operator
Parallelization with the publishOn operator
The subscribeOn operator
The parallel operator
Scheduler
Rector Context
Internals of Project Reactor
Macro-fusion
Micro-fusion
Summary
Going Reactive with Spring Boot 2
A fast start as the key to success
Using Spring Roo to try to develop applications faster
Spring Boot as a key to fast-growing applications
Reactive in Spring Boot 2.0
Reactive in Spring Core
Support for reactive types conversion
Reactive I/O
Reactive in web
Reactive in Spring Data
Reactive in Spring Session
Reactive in Spring Security
Reactive in Spring Cloud
Reactive in Spring Test
Reactive in monitoring
Summary
WebFlux Async Non-Blocking Communication
WebFlux as a central reactive server foundation
The reactive web core
The reactive web and MVC frameworks
Purely functional web with WebFlux
Non-blocking cross-service communication with WebClient
Reactive WebSocket API
Server-side WebSocket API
Client-side WebSocket API
WebFlux WebSocket versus the Spring WebSocket module
Reactive SSE as a lightweight replacement for WebSockets
Reactive template engines
Reactive web security
Reactive access to SecurityContext
Enabling reactive security
Interaction with other reactive libraries
WebFlux versus Web MVC
Laws matter when comparing frameworks
Little's Law
Amdahl's Law
The Universal Scalability Law
Thorough analysis and comparison
Understanding the processing models in WebFlux and Web MVC
Impact of processing models on throughput and latency
Challenges with the WebFlux processing model
Impact of different processing models on memory consumption
Impact of processing models on usability
Application of WebFlux
Microservice-based systems
Systems that handle clients with slow connections
Streaming or real-time systems
WebFlux in action
Summary
Reactive Database Access
Data handling patterns in the modern world
Domain-driven design
Data stores in the era of microservices
Polyglot persistence
Database as a Service
Sharing data across microservices
Distributed transactions
Event-driven architecture
Eventual consistency
The SAGA pattern
Event sourcing
Command Query Responsibility Segregation
Conflict-free replicated data types
Messaging system as a data store
Synchronous model for data retrieval
Wire protocol for database access
Database driver
JDBC
Connection management
Making relational database access reactive
Spring JDBC
Spring Data JDBC
Making Spring Data JDBC reactive
JPA
Making JPA reactive
Spring Data JPA
Making Spring Data JPA reactive
Spring Data NoSQL
Limitations of the synchronous model
Advantages of the synchronous model
Reactive data access with Spring Data
Using MongoDB reactive repository
Combining repository operations
How reactive repositories work
Pagination support
ReactiveMongoRepository implementation details
Using ReactiveMongoTemplate
Using reactive drivers (MongoDB)
Using asynchronous drivers (Cassandra)
Reactive transactions
Reactive transactions with MongoDB 4
Distributed transactions with the SAGA pattern
Spring Data reactive connectors
Reactive MongoDB connector
Reactive Cassandra connector
Reactive Couchbase connector
Reactive Redis connector
Limitations and anticipated improvements
Asynchronous Database Access
Reactive Relational Database Connectivity
Using R2DBC with Spring Data R2DBC
Transforming a synchronous repository into reactive
Using the rxjava2-jdbc library
Wrapping a synchronous CrudRepository
Reactive Spring Data in action
Summary
Scaling Up with Cloud Streams
Message brokers as the key to message-driven systems
Server-side load balancing
Client-side load balancing with Spring Cloud and Ribbon
Message brokers as an elastic reliable layer for message transferring
The market of message brokers
Spring Cloud Streams as a bridge to Spring Ecosystem
Reactive programming in the cloud
Spring Cloud Data Flow
The finest-grained application with Spring Cloud Function
Spring Cloud – function as a part of a data flow
RSocket for low-latency reactive message passing
RSocket versus Reactor-Netty
RSocket in Java
RSocket versus gRPC
RSocket in Spring Framework
RSocket in other frameworks
The ScaleCube Project
The Proteus Project
Summarizing RSocket
Summary
Testing the Reactive Application
Why are reactive streams hard to test?
Testing reactive streams with StepVerifier
Essentials of StepVerifier
Advanced testing with StepVerifier
Dealing with virtual time
Verifying reactive context
Testing WebFlux
Testing Controllers with WebTestClient
Testing WebSocket
Summary
And Finally Release It!
The importance of DevOps-friendly apps
Monitoring the Reactive Spring application
Spring Boot Actuator
Adding an actuator to the project
Service info endpoint
Health information endpoint
Metrics endpoint
Loggers management endpoint
Other valuable endpoints
Writing custom actuator endpoints
Securing actuator endpoints
Micrometer
Default Spring Boot metrics
Monitoring Reactive Streams
Monitoring reactor flows
Monitoring reactor schedulers
Adding custom Micrometer meters
Distributed tracing with Spring Boot Sleuth
Pretty UI with Spring Boot Admin 2.x
Deploying to the cloud
Deploying to Amazon Web Services
Deploying to the Google Kubernetes Engine
Deploying to Pivotal Cloud Foundry
Discovering RabbitMQ in PCF
Discovering MongoDB in PCF
Configurationless deployment with Spring Cloud Data Flow for PCF
Knative for FaaS over Kubernetes and Istio
Bits of advice for successful application deployment
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
更新时间:2021-07-23 16:37:22