Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Going reactive with Spring Data Mark Paluch, Pivotal Software, Inc. @mp911de
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ @mp911de github.com/mp911de paluch.biz Mark Paluch
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 3 Request Data access Remote data service
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 3 Request Data access Remote data service
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 3 Request Data access Remote data service I/O Wait
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 3 Request Data access Remote data service I/O Wait
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 3 Request Data access Remote data service I/O Wait This one is waiting
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 3 Request Data access Remote data service I/O Wait This one is waiting
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 4 Request Data access Remote data service
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 4 Request Data access Remote data service Bulk fetch
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 4 Request Data access Remote data service Multiple calls Bulk fetch
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 4 Request Data access Remote data service Multiple calls Bulk fetch
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Accessing Data today 4 Request Data access Remote data service Multiple calls Bulk fetch
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous data access 5 Request Data access
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous data access 5 Request Data access
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous data access 5 Request Data access
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous data access 5 Request Data access
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous data access 5 Request Data access Requires synchronization
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous data access 5 Request Data access Requires synchronization Still waiting, eh?
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Asynchronous data access 5 Request Data access Requires synchronization Still waiting, eh?
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Conditional asynchronous access 6
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Conditional asynchronous access 12 Future Hell
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Conditional asynchronous access 12 Future Hell
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Keeps more Threads busy ! Transformation improved (since Java 5, java.util.concurrent) ! Processing starts at the time all elements are available (effectively) 13 Asynchronous Data Access
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Keep resources busy ! Connection contention ! Usually synchronous/blocking ! Multiple requests ! Asynchronous isn’t always a good answer 14 Todays’ Data Access
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Change the level of abstraction 16 Data as Stream Reactive execution model
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 17 List<T> Iterator<T> Future<T> Future<List<T>>
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 17 List<T> Iterator<T> Future<T> Future<List<T>> .get() for-each .hasNext()
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 18 Publisher<T> I/O thread push
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 19 Publisher Stream (Publisher) Subscriber Demand Data
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 19 Publisher Stream (Publisher) Subscriber Demand Data
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 20 Publisher Stream (Publisher) Subscriber Demand Data
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 20 Publisher Stream (Publisher) Subscriber Demand Data
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Immutable ! Push-Stream ! Iterator, java.stream.Stream are Pull-Streams ! Demand-Aware (Backpressure) 21 Reactive Streams
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Going reactive with Spring Data 22 Project Reactor 3.0 Spring Data 2.0 Spring Framework 5.0
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 23 Mono<T> Flux<T> 0..1..Error 0..N..Error
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! Reactive Template API ! Reactive Repository support ! Supported data stores (Reactive Streams) ! MongoDB ! Apache Cassandra ! Redis 24 Spring Data
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 25 Reactive Template API <T> Mono<T> insert(T objectToSave) <T> Mono<T> insert(Mono<T> objectToSave)
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 26 Demo Reactive Template API
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 31 Demo Reactive Repositories
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ ! End-to-End reactive experience ! RxJava Interoperability at Repository level ! Infinite Streams ! MongoDB Tailable Cursors ! Redis Pub/Sub 32 Spring Data Reactive Features
Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Resources ! Spring Data Examples – Repository @ Github ! Spring Data wiki (Release trains, planning) – Wiki ! Spring projects release calendar – Google Calendar ! Slides – Speakerdeck (mp911.de/going-reactive) ! Chat with us on Gitter! 34 @mp911de