liveBook · Manning

Reactive application

As explained in Spring Start Here, Second Edition

A reactive application coordinates asynchronous data flows and tasks without blocking threads during I/O.

A reactive application represents work as tasks with dependencies instead of making one thread wait through every I/O operation. Available threads can take on other tasks while a request waits. This approach suits some applications, but can complicate others; WebClient is recommended here only for reactive apps. section 11.4

Calculating a client’s total debt

A banking application may need to call several services to calculate a client’s total debt. In a reactive design, those steps become tasks with dependencies, rather than a single thread waiting at each service call. section 11.4

Figure 11.8 An analogy of the way a reactive app works. A thread doesn’t take a request’s tasks in order and wait when it’s blocked. Instead, all tasks from all requests are on a backlog. Any available thread can work on tasks from any request. This way, independent tasks can be solved in parallel, and the threads don’t stay idle.

The diagram compares a thread waiting through one request with available threads picking up tasks from a shared backlog. section 11.4

How Spring Start Here, Second Edition covers it

How deep it goes
Explains blocking I/O, task dependencies, and thread scheduling, while recommending deeper study of reactive programming.
Examples
Uses a banking debt calculation involving several service calls and a WebClient payment request.
What it assumes
Assumes familiarity with application basics and recommends learning reactive programming after those basics.
What you can do after
Evaluate whether WebClient fits a reactive application rather than a nonreactive REST client.
How it connects
Connects reactive applications with WebClient, Spring WebFlux, and REST clients.

Also explained in

Compare how 2 books explain reactive application →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.