Reactive databases

All normal databases operations are blocking; that is, the thread waits until a response is received from the database.

To fully benefit from Reactive Programming, end-to-end communication has to be reactive, that is, based on event streams.

ReactiveMongo is designed to be reactive and avoid blocking operations. All operations, including select, update, or delete, return immediately. Data can be streamed into and out of the database using event streams.

In this section, we will use the Spring Boot Reactive MongoDB starter to create a simple example connecting to ReactiveMongo.

The following steps are involved:

  1. Integrating Spring Boot Reactive MongoDB Starter.
  2. Creating a model object the stock document.
  3. Creating reactiveCrudRepository ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.