AsyncReactiveProgramming icon indicating copy to clipboard operation
AsyncReactiveProgramming copied to clipboard

This repository is intended to be a compilation of presentations, examples, links, and other resources on asynchronous and reactive programming in Java

= Asynchronous & reactive programming with Java Marcos de la Calle Samaniego, @marcosDLCS [email protected] v1.0.4, 2020-12-20 :toc:

++++

++++

== ๐Ÿ™‹โ€โ™‚๏ธ Presentation

This repository is intended to be a compilation of presentations, examples, links, and other resources on asynchronous and reactive programming in Java.

This initiative is part of the final project of: https://www.codeurjc.es/mastercloudapps/[Mรกster Cloud Apps. Desarrollo y despliegue de aplicaciones en la nube, window=_blank] [ ๐Ÿ‡ช๐Ÿ‡ธ ]

++++

++++

The project also provides, as documentation, a presentation about asynchronous and reactive programming in Java. You can check the slides here:

[cols="9,4,3,3,1"] |=== |Name |Version |Download |Updated at | Lang

| Presentaciรณn: Programaciรณn asรญncrona y reactiva con Java | 1.0.0 | https://drive.google.com/file/d/1Whum-P6f5nqzq3Qj55C-p2DNLFvEKDBC/view?usp=sharing[pptx, window=blank] or https://drive.google.com/file/d/1bnDI5x$$$$jeQ1uV9MXXmi8-jbUGZ0Rfm9Z/view?usp=sharing[pdf, window=_blank] | 2020-12-08 | ๐Ÿ‡ช๐Ÿ‡ธ

| Slides: Asynchronous and reactive programming with Java | 0.0.3 | https://drive.google.com/file/d/1vfMmL__LiVgOm2fLsEiZVVHBcqgiD4Ez/view?usp=sharing[pptx, window=_blank] or https://drive.google.com/file/d/11zZQBMAHh0cgV2gVhK-6L5KEZ4i9-hSv/view?usp=sharing[pdf, window=_blank] | 2020-11-18 | ๐Ÿ‡ฌ๐Ÿ‡ง |===

=== ๐Ÿ‘ฉ๐Ÿปโ€๐Ÿซ Academic resources

On the other hand, the academic resources delivered as part of the completion of the project are also included:

[cols="9,4,3,3,1"] |=== |Name |Version |Download |Updated at | Lang

| Memoria: Programaciรณn asรญncrona y reactiva con Java | 1.0.0 | https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/resources/academic/memoria.pdf[pdf, window=_blank] | 2020-12-14 | ๐Ÿ‡ช๐Ÿ‡ธ

| Presentaciรณn: Programaciรณn asรญncrona y reactiva con Java | 1.0.0 | https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/resources/academic/presentacion_tfm.pdf[pdf, window=_blank] | 2020-12-14 | ๐Ÿ‡ช๐Ÿ‡ธ |===

== ๐Ÿ“ Examples

This section lists a series of examples that are intended to guide the content of the presentation.

Each of the mentioned examples are based on the latest version of Java (15+) and https://spring.io/projects/spring-boot[Spring Boot (2.4+), window=_blank].

https://maven.apache.org/[Maven (3.6+), window=_blank] or https://gradle.org/[Gradle (6+), window=_blank] will be used as build/dependency management tool. In addition, some examples will use the https://projectlombok.org/[Lombok, window=_blank] library to generate code through annotations

  • https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/examples/00-reactor-operators[Example 00. Reactor operators]: Simple project to practice with Project Reactor main operators. The purpose of the example is to show the behavior of Mono, Flux and their possibilities

  • https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/examples/01-basic-comparison[Example 01. Basic comparison]: Basic CRUD API (GET, POST, PUT, DELETE) in two flavors, Spring MVC and Spring WebFlux

  • https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/examples/02-using-spring-webclient[Example 02. Using Spring WebClient]: Basic API to retrieve information from remote web services using the reactive WebClient

  • https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/examples/03-gateway[Example 03. Gateway!]: Gateway service to route requests to worker services to practice with Spring Cloud Gateway project

  • https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/examples/04-reactive-db-access-with-r2dbc[Example 04. Reactive DB access with R2DBC]: Simple API with an internal relational PostgreSQL repository. R2DBC provides reactive non-blocking APIs to relational databases

  • https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/examples/05-rsocket[Example 05. Protocols. RSocket]: A simple project to know thow the reactive binary protocol RSocket works. The example includes two small modules that communicate with each other, exploring the different possibilities that RSocket offers to us

  • https://github.com/MasterCloudApps-Projects/AsyncReactiveProgramming/tree/master/examples/06-project-loom[Example 06. Project Loom]: Example for a first contact with Project Loom, its implementation and how to start with Virtual Threads

== ๐Ÿ”— Resources

=== ๐Ÿ‘ผ๐Ÿป Fundamentals

  • https://www.reactive.foundation/[Reactive foundation, window=_blank]
  • https://www.reactivemanifesto.org/[The reactive manifesto, window=_blank]
  • https://principles.reactive.foundation/[The reactive principles, window=_blank]
  • https://12factor.net/[12 Factor App, window=_blank]
  • https://www.reactive-streams.org/[Reactive Streams Specification, window=_blank]
  • https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/Flow.html[Java 11 Flow, window=_blank]
  • https://projectreactor.io/[Project Reactor, window=_blank]

=== ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Main Reactive Streams implementations

  • https://projectreactor.io/[Project Reactor, window=_blank]
  • https://github.com/ReactiveX/RxJava[RxJava, window=_blank]
  • https://vertx.io/[VertX, window=_blank]
  • https://doc.akka.io/docs/akka/current/stream/index.html[Akka Streams, window=_blank]

=== ๐Ÿ€ Spring ecosystem

It seems obvious but the best place to find good information about the Spring ecosystem is its official documentation:

  • https://docs.spring.io/spring-framework/docs/current/reference/html[Spring Framework Docs, window=_blank]
  • https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle[Spring Boot Docs, window=_blank]
  • https://projectreactor.io/docs/core/release/reference[Project Reactor Docs, window=_blank]

[cols="6,3,2,1"] .Interesting videos and articles about Reactive Spring |=== |Name |Author |Year |Info

| https://www.infoq.com/presentations/spring-reactive-webflux[Guide to "Reactive" for Spring MVC Developers, window=_blank] | Rossen Stoyanchev | 2018 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://www.youtube.com/watch?v=vSHNBgY7MGA&ab_channel=SpringI%2FO[Moving from Imperative to Reactive, window=_blank] | Paul Harris | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://hazelcast.com/blog/migrating-from-imperative-to-reactive[Migrating from Imperative to Reactive, window=_blank] | Nicholas Frankel | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://www.youtube.com/watch?v=0rnMIueRKNU&ab_channel=SpringDeveloper[Doโ€™s and Donโ€™ts: Avoiding First-Time Reactive Programmer Mines, window=_blank] |Sergei Egorov |2019 |๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://www.youtube.com/watch?v=ODzY5uJfzDI&ab_channel=SpringI%2FO[Benefits of reactive programming with Reactor and Spring Boot 2, window=_blank] | Violeta Georgieva | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://www.youtube.com/watch?v=xCu73WVg8Ps&ab_channel=SpringDeveloper[Avoiding Reactor Meltdown, window=_blank] | Phil Clay | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://www.youtube.com/watch?v=pyqIpqCt8PU&ab_channel=vJUG[Reactive Performance, window=_blank] | Oleh Dokuka | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://www.youtube.com/watch?v=qwF6v6FN_Uc&ab_channel=SpringDeveloper[Getting Started with R2DBC, window=_blank] | Mark Heckler | 2018 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://www.youtube.com/watch?v=ipVfRdl5SP0&ab_channel=SpringDeveloper[The RSocket Revolution, window=_blank] | Josh Long | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://www.youtube.com/watch?v=hfupNIxzNP4&ab_channel=SpringI%2FO[Flight of the Flux: A look at Reactor execution model, window=_blank] | Simon Baslรฉ | 2018 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://spring.io/blog/2019/03/06/flight-of-the-flux-1-assembly-vs-subscription[Flight of the Flux 1 - Assembly vs Subscription, window=_blank] | Simon Baslรฉ | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://spring.io/blog/2019/04/16/flight-of-the-flux-2-debugging-caveats[Flight of the Flux 2 - Debugging Caveats, window=_blank] | Simon Baslรฉ | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://spring.io/blog/2019/12/13/flight-of-the-flux-3-hopping-threads-and-schedulers[Flight of the Flux 3 - Hopping Threads and Schedulers, window=_blank] | Simon Baslรฉ | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://projectreactor.io/docs/core/release/reference/#which-operator[Project Reactor: Which operator do I need? (Appendix A), window=_blank]

Project Reactor Docs
๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹
===

=== ๐ŸŒˆ Other framework ecosystems

[cols="6,3,1,2,1"] .Interesting videos and articles about other frameworks and ecosystems |=== |Name |Author |Year | Ecosystem| Info

https://quarkus.io/guides/getting-started-reactive[Quarkus - Getting started with Reactive, window=_blank]
-
Quarkus
๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://www.youtube.com/watch?v=kWlrGtwvOxg&ab_channel=RedHatDeveloper/[Reactive Quarkusโ€“A Java Mutiny, window=_blank] | Clement Escoffier | 2020 | Quarkus | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

https://docs.micronaut.io/latest/guide/index.html#reactiveServer[Reactive HTTP Request Processing]
-
Micronaut
๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹
https://docs.micronaut.io/latest/guide/index.html#reactiveServer[Configurations for Reactive Programming]
-
Micronaut
๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://www.youtube.com/watch?v=EvkSWuo7Mig&ab_channel=Autentia[Microservicios reactivos con Micronaut] | Ivรกn Lรณpez | 2019 | Micronaut |๐Ÿ‡ช๐Ÿ‡ธ ๐Ÿ“น

| https://piotrminkowski.com/2019/11/12/micronaut-tutorial-reactive/[Micronaut Tutorial: Reactive] | Piotr Minkowski | 2019 | Micronaut |๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹ |===

=== โ˜• Project Loom

First and foremost: What is Project Loom?

According to https://wiki.openjdk.java.net/display/loom/Main[OpenJDK Wiki, window=_blank]:

==== Project Loom is to intended to explore, incubate and deliver Java VM features and APIs built on top of them for the purpose of supporting easy-to-use, high-throughput lightweight concurrency and new programming models on the Java platform. This is accomplished by the addition of the following constructs:

  • Virtual threads
  • Delimited continuations
  • Tail-call elimination ====

[cols="6,3,2,1"] .Interesting articles and resources about Project Loom |=== |Name |Author |Year |Info

https://wiki.openjdk.java.net/display/loom/Main[Loom - OpenJDK Wiki, window=_blank]
-
๐Ÿ‡ฌ๐Ÿ‡ง

| https://youtu.be/23HjZBOIshY/[Project Loom: Modern Scalable Concurrency for the Java Platform, window=_blank] | Ron Pressler | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“น

| https://inside.java/2020/08/07/loom-performance/[On the performance of user-mode threads and coroutines, window=_blank] | Ron Pressler | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://blog.frankel.ch/project-loom-reactive-coroutines/[On Project Loom, the Reactive model and coroutines, window=_blank] | Nicholas Frankel | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://i-rant.arnaudbos.com/loom-part-0-rationale/[Loom - Part 0 - Rationale, window=_blank] |Arnaud Bos |2019 |๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://i-rant.arnaudbos.com/loom-part-1-scheduling/[Loom - Part 1 - It's all about Scheduling, window=_blank] | Arnaud Bos | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://i-rant.arnaudbos.com/loom-part-2-blocking/[Loom - Part 2 - Blocking code, window=_blank] | Arnaud Bos | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://i-rant.arnaudbos.com/loom-part-3-async/[Loom - Part 3 - Asynchronous code, window=_blank] | Arnaud Bos | 2019 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://i-rant.arnaudbos.com/loom-part-4-nio/[Loom - Part 4 - Non-thread-blocking async I/O, window=_blank] | Arnaud Bos | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://paluch.biz/blog/182-experimenting-with-project-loom-eap-and-spring-webmvc.html[Experimenting with Project Loom EAP and Spring WebMVC, window=_blank] | Mark Paluch | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹

| https://www.javaadvent.com/2020/12/project-loom-and-structured-concurrency.html[Project Loom and structured concurrency, window=_blank] | Cay Horstmann | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ“‹ |===

=== โš’๏ธ Libraries and tools

[cols="2,5"] .Recommended libraries and tools |=== |Name |Description

| https://visualvm.github.io/[VisualVM, window=_blank] | VisualVM is a visual tool integrating commandline JDK tools and lightweight profiling capabilities. Designed for both development and production time use

| https://github.com/openjdk/jmc[Java Mission Control, window=_blank] | Mission Control is an open source production time profiling and diagnostics tool for Java

| http://www.awaitility.org/[Awaitility, window=_blank] | Awaitility is a DSL that allows you to express expectations of an asynchronous system in a concise and easy to read manner

| https://github.com/reactor/BlockHound[BlockHound, window=_blank] | Java agent to detect blocking calls from non-blocking threads

| https://github.com/reactor/reactor-core/tree/master/reactor-tools[Reactor Tools, window=_blank] | A set of tools to improve Project Reactor's debugging and development experience. Starting from Reactor 3.3.0.M2, reactor-tools is now moved to reactor-core

| https://github.com/reactor/reactor-addons[Reactor Addons, window=_blank] | Reactor-adapter and reactor-extras utils

| https://github.com/reactor/reactor-core/tree/master/reactor-tools[Rx Marbles, window=_blank] | A webapp for experimenting with diagrams of Rx Observables, for learning purposes |===

=== ๐Ÿ“• Books

[cols="6,3,2,1"] .Recommended books |=== |Name |Author |Year |Lang

| https://www.goodreads.com/book/show/21799444-reactive-design-patterns[Reactive Design Patterns, window=_blank] | Roland Kuhn, Jamie Allen | 2014 | ๐Ÿ‡ฌ๐Ÿ‡ง

| https://www.goodreads.com/book/show/23752020-reactive-application-development[Reactive Application Development, window=_blank] | Sean Walsh, Duncan K. DeVore, Brian Hanafee | 2018 | ๐Ÿ‡ฌ๐Ÿ‡ง

| https://www.goodreads.com/book/show/28321006-reactive-programming-with-rxjava[Reactive Programming with RxJava: Creating Asynchronous, Event-Based Applications, window=_blank] | Tomasz Nurkiewicz, Ben Christensen | 2016 | ๐Ÿ‡ฌ๐Ÿ‡ง

| https://www.goodreads.com/book/show/53722460-hacking-with-spring-boot-2-3[Hacking with Spring Boot 2.3: Reactive Edition, window=_blank] | Greg L. Turnquist | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง

| https://www.goodreads.com/book/show/49450069-reactive-spring[Reactive Spring, window=_blank] | Josh Long | 2020 | ๐Ÿ‡ฌ๐Ÿ‡ง

| https://www.goodreads.com/book/show/55182022-spring-boot[Spring Boot: Up and Running: Building Cloud Native Java and Kotlin Applications, window=_blank] | Mark Heckler | 2021 | ๐Ÿ‡ฌ๐Ÿ‡ง |===

=== ๐Ÿ‘ฃ Courses

[cols="6,3,2,1"] .Recommended courses |=== |Name |Author |Platform |Lang

| https://www.youtube.com/playlist?list=PLL8woMHwr36EDxjUoCzboZjedsnhLP1j4[Java concurrency and multithreading (playlist), window=_blank] | Jakob Jenkov | Youtube | ๐Ÿ‡ฌ๐Ÿ‡ง

| https://www.udemy.com/course/efficient-java-multithreading-with-executors/[Efficient Java Multithreading and Concurrency with Executors, window=_blank] | Arun Kumar | Udemy | ๐Ÿ‡ฌ๐Ÿ‡ง

| https://learning.oreilly.com/library/view/reactive-spring-boot/9780136836421/[Reactive Spring, 2nd Edition, window=_blank] | Josh Long | Oreilly | ๐Ÿ‡ฌ๐Ÿ‡ง |===

== ๐Ÿšถโ€โ™€๏ธ Who to follow?

=== ๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป People

  • Simon Baslรฉ, https://twitter.com/simonbasle[@simonbasle, window=_blank]
  • Jonas Bonรฉr, https://twitter.com/jboner[@jboner, window=_blank]
  • Arnaud Bos, https://twitter.com/arnaud_bos[@arnaud_bos, window=_blank]
  • Oleh Dokuka, https://twitter.com/OlehDokuka[@OlehDokuka, window=_blank]
  • Sergei Egorov, https://twitter.com/bsideup[@bsideup, window=_blank]
  • Clement Escoffier, https://twitter.com/clementplop[@clementplop, window=_blank]
  • Nicholas Frankel, https://twitter.com/nicolas_frankel[@nicolas_frankel, window=_blank]
  • Violeta Georgieva, https://twitter.com/violeta_g_g[@violeta_g_g, window=_blank]
  • Mark Heckler, https://twitter.com/mkheck[@mkheck, window=_blank]
  • David Karnok, https://twitter.com/akarnokd[@akarnokd, window=_blank]
  • Josh Long, https://twitter.com/starbuxman[@starbuxman, window=_blank]
  • Audrey Neveu, https://twitter.com/Audrey_Neveu[@Audrey_Neveu, window=_blank]
  • Mark Paluch, https://twitter.com/mp911de[@mp911de, window=_blank]
  • Ron Pressler, https://twitter.com/pressron[@pressron, window=_blank]
  • Rossen Stoyanchev, https://twitter.com/rstoya05[@rstoya05, window=_blank]
  • Dave Syer, https://twitter.com/david_syer[@david_syer, window=_blank]
  • Ben Wilcock, https://twitter.com/benbravo73[@benbravo73, window=_blank]

=== ๐Ÿ‘ฎ๐Ÿปโ€โ™‚๏ธ Official accounts

  • Akka Team, https://twitter.com/akkateam[@akkateam, window=_blank]
  • Project Reactor, https://twitter.com/ProjectReactor[@ProjectReactor, window=_blank]
  • R2DBC, https://twitter.com/r2dbc[@r2dbc, window=_blank]
  • RSocket, https://twitter.com/RSocketIO[@RSocketIO, window=_blank]
  • RxJava, https://twitter.com/RxJava[@RxJava, window=_blank]
  • Eclipse Vert.x, https://twitter.com/vertx_project[@vertx_project, window=_blank]

=== ๐Ÿก Sites

  • https://spring.io/blog/[Spring Blog, window=_blank]
  • https://www.baeldung.com/[Baeldung, window=_blank]
  • https://www.infoq.com/reactive-programming/[InfoQ: Reactive Programming, window=_blank]
  • https://dzone.com/[DZone, window=_blank]

== ๐Ÿค Credits

  • Coffee-love https://thenounproject.com/term/coffee-lover/1949347/[icon, window=_blank] by https://thenounproject.com/[The Noun Project, window=_blank] โ˜• โค๏ธ