Slide 1

Slide 1 text

Reactive Spring Data Mark Paluch @mp911de Christoph Strobl @stroblchristoph 1

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Data Modules 3 JPA

Slide 4

Slide 4 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Spring Data Modules 4 JPA

Slide 5

Slide 5 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ image: Fire at the Bamber Family Home (FAL v.1.3 License)

Slide 6

Slide 6 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Slide 7

Slide 7 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ image: Fire at the Bamber Family Home (FAL v.1.3 License)

Slide 8

Slide 8 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ image: Fire at the Bamber Family Home (FAL v.1.3 License)

Slide 9

Slide 9 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ image: Fire at the Bamber Family Home (FAL v.1.3 License)

Slide 10

Slide 10 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ image: Fire at the Bamber Family Home (FAL v.1.3 License)

Slide 11

Slide 11 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Today’s data access • Keep resources busy • Connection contention • Usually synchronous/blocking • Multiple requests • Asynchronous isn’t always a good answer X

Slide 12

Slide 12 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive data access • Asynchronous • Non Blocking • Event Driven • Data as stream 11

Slide 13

Slide 13 text

Publisher Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ image: Fire at the Bamber Family Home (FAL v.1.3 License) Subscriber Backpressure Stream / Flow Subscribe

Slide 14

Slide 14 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What it takes… Project Reactor 3.1 Spring Framework 5.0 Spring Data 2.0 A reactive (asynchronous, ideally non-blocking) driver Optional: Spring Boot 2.0 (Milestone) 13

Slide 15

Slide 15 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What about JDBC/JPA? JDBC is a blocking API JPA is a blocking API Sorry, no reactive JPA support 14

Slide 16

Slide 16 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Spring Data Reactive Template API Reactive Repository support Reduced feature set 15

Slide 17

Slide 17 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Imperative Template API 16 T insert(T objectToSave) void insertAll(Collection<…> objects) List find(Query query, Class type)

Slide 18

Slide 18 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Template API 17 Mono insert(T objectToSave) Mono insert(Mono objects) Flux find(Query query, Class type)

Slide 19

Slide 19 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Repository API 18 interface ReactivePersonRepository extends ReactiveCrudRepository {
 
 Flux findByLastname(String lastname);
 
 @Query("{ 'firstname': ?0 }")
 Mono customQuery(String firstname); Flux findByLastname(Mono lastname); }

Slide 20

Slide 20 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Repository API 19 interface ReactivePersonRepository extends ReactiveCrudRepository {
 
 Flux findByLastname(String lastname);
 
 @Query("{ 'firstname': ?0 }")
 Mono customQuery(String firstname); Flux findByLastname(Mono lastname); }

Slide 21

Slide 21 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Repository API 20 interface ReactivePersonRepository extends ReactiveCrudRepository {
 
 Flux findByLastname(String lastname);
 
 @Query("{ 'firstname': ?0 }")
 Mono customQuery(String firstname); Flux findByLastname(Mono lastname); }

Slide 22

Slide 22 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Repository API 21 interface ReactivePersonRepository extends ReactiveCrudRepository {
 
 Flux findByLastname(String lastname);
 
 @Query("{ 'firstname': ?0 }")
 Mono customQuery(String firstname); Flux findByLastname(Mono lastname); }

Slide 23

Slide 23 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Repository API 22 interface ReactivePersonRepository extends RxJava2CrudRepository {
 
 Flowable findByLastname(String lastname);
 
 @Query("{ 'firstname': ?0 }")
 Maybe customQuery(String firstname); Single findByLastname(Mono lastname); }

Slide 24

Slide 24 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Repository API 23 interface ReactivePersonRepository extends RxJava2CrudRepository {
 
 Flowable findByLastname(String lastname);
 
 @Query("{ 'firstname': ?0 }")
 Maybe customQuery(String firstname); Single findByLastname(Mono lastname); }

Slide 25

Slide 25 text

Learn More. Stay Connected. Spring Data Examples – Repository @ Github WebFlux Example – Repository @ Github 24 #springone @s1p

Slide 26

Slide 26 text

Disclaimer

Slide 27

Slide 27 text

Unless otherwise indicated, these slides are © 2013-2017 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Safe Harbor Statement The following is intended to outline the general direction of Pivotal's offerings. It is intended for information purposes only and may not be incorporated into any contract. Any information regarding pre-release of Pivotal offerings, future updates or other planned modifications is subject to ongoing evaluation by Pivotal and is subject to change. This information is provided without warranty or any kind, express or implied, and is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions regarding Pivotal's offerings. These purchasing decisions should only be based on features currently available. The development, release, and timing of any features or functionality described for Pivotal's offerings in this presentation remain at the sole discretion of Pivotal. Pivotal has no obligation to update forward looking information in this presentation. 26