Example of two end-to-end reactive, backpressure aware web applications utilising 3 modern reactive streams oriented drivers and I/O connectors:
- Spring WebFlux for reactvie web
- MongoDB Reactive Streams driver for reactive NoSQL access
- RSocket for reactive S2S network communication
The application streams integers from mongo, to an RSocket server which in turn sums them and streams them back via an RSocket channel to the Spring Boot WebFlux application which in turn streams them back to the client requester via JSON streaming.
All of this happens with single request backpressure with 1 second delay on the RSocket server.
Run the Spring Boot (WebFlux) web application with:
mvn spring-boot:run
and startup the RSocket server implementation with:
mvn exec:java -Dexec.mainClass="reactive.demo.Client"
Request the streaming endpoint with:
curl localhost:8080/sum