dev-resources.site
for different kinds of informations.
Project Reactor: Tips (1)
Published at
4/13/2024
Categories
java
reactiveprogramming
projectreactor
Author
saladlam
Author
8 person written this
saladlam
open
Don't know to use which operators
In Reactor 3 Reference Guide, there is some use case may to use directly.
To check if subscriber is attached
Nothing is printed after executed following statement.
Flux<Integer> f = Flux.just(1, 2, 3, 4).map(v -> {
LOGGER.debug("value received in map(): {}", v);
return v * v;
});
Remember to attach a subscriber, or blocking functionΒ at the end of the operator chain, otherwise nothing happened. Following is the possible function
- subscribe()
- blockFirst() (blocking)
- blockLast() (blocking)
- toIterable() (blocking)
- toStream() (blocking)
About time of class instantiation of just()
Flux<Integer> f = Flux.just(new Car("Mercedes-Benz"), new Car("Toyoto")); // (1)
f.subscribe(); // (2)
Class Car will be instantiated when executing (1). If want to defer the class instantiation on (2), please wrap just() by defer()/deferContextual().
Flux<Integer> f = Flux.defer(() -> Flux.just(new Car("Mercedes-Benz"), new Car("Toyoto"))); // (1)
f.subscribe(); // (2)
reactiveprogramming Article's
30 articles in total
RxJS: The Reactive Revolution in JavaScript π
read article
Building Real-Time Applications with WebSockets and Reactive Streams
read article
Building Scalable Applications with Kafka and Reactive Programming
read article
Mastering Back Pressure in Reactive Distributed Systems
read article
Reactive Programming with Spring Boot and Web Flux
read article
Unleashing Reactive Programming: Boosting Responsiveness, Resilience, and Scalability
read article
Project Reactor: About Fuseable interface ASYNC mode under different threads
read article
Project Reactor: About Fuseable interface ASYNC mode under the same thread
read article
Project Reactor: About Fuseable interface SYNC mode
read article
Project Reactor: About Scannable interface
read article
Project Reactor: About the side effect operator
read article
Project Reactor: Tips (1)
currently reading
MJPEG stream demo server by Reactor netty
read article
Reactor Netty: HTTP server example
read article
Reactor Netty: UDP DNS client example
read article
19 Best React devtools in 2024
read article
Exploring the Role of Reactive Programming in Event-Driven Architectures
read article
Should we use Reactive architecture with Java?
read article
Signals in Angular β How to Write More Reactive Code
read article
Why Every Developer Must Know Reactive Programming
read article
Reactive database access on the JVM
read article
Why You Should Use Spring WebFlux Instead of the @Async Annotation
read article
Create DTO using get results from repository returns duplicate values in Spring Boot Reactive WebFlux
read article
The Architecture of the Reactivity Layer in Solid.js
read article
The Advantages of Using Solid.js for Web Development
read article
Angular - Rxjs - Operator mergeAll
read article
Angular - Rxjs - Operator map
read article
Building An Infinite Scroll Into Your React App
read article
The Best New Way To Cache API Responses with Angular & RxJs
read article
Reactive Programming
read article
Featured ones: