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.
  4. Initialising stock data using Command-line Runner.
  5. Creating Reactive methods in Rest Controller.
  6. Updating the view to subscribe to the event stream.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset