Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Spring Mark Paluch, Pivotal Software, Inc. @mp911de
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Makes assumptions over resource usage ! Developers are in charge of resource usage efficiency 3 Imperative programming
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Container calls code on a Thread ! Thread is occupied ! Thread is released at the end of work 4 Imperative: Web applications
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Use Case: Synchronous fetch model 5 Service App Data store App Service
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Reactive is used to describe event-driven systems ! Reactive is used more for scalability and stability than for speed ! Reacts to resource availability 6 What is reactive?
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Use Case: Push message to client 9 Server Message Broker
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Live (continuous) database queries ! UI event handling (Android) ! Big Data ! Real time analytics ! HTTP/2 (flow control) 10 Other use cases
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Collaborative initiative to provide a standard for asynchronous stream processing with non-blocking back pressure. ! Co-designed by Twitter, Lightbend, Pivotal, Netflix and many others ! De-facto interop standard ! Java 9: Flow API 11 Reactive Streams
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Publisher and Subscriber 13 Subscriber Publisher Publish as fast as possible
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Spring’s reactive web framework ! End to end non-blocking and asynchronous execution 18 What is WebFlux?
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 26 Request Data access Remote data service I/O Wait
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 27 Request Data access Remote data service Multiple calls Bulk fetch
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Project Reactor 3.0 ! Spring Framework 5.0 ! Spring Data 2.0 ! A reactive (asynchronous, ideally non-blocking) driver ! Optional: Spring Boot 2.0 29 Requirements for Reactive Spring Data
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! JDBC is a blocking API ! JPA is a blocking API ! Sorry, no reactive JPA support 32 What about JPA
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Reactive Template API ! Reactive Repository support ! Reduced feature set 33 Reactive Spring Data