liveBook · Manning

Reactive repository support

As explained in Spring in Action, Sixth Edition

A reactive Cassandra repository is a repository abstraction for Cassandra persistence whose data-access operations expose reactive publishers.

Reactive repository support gives Spring Data repositories nonblocking data-access operations through reactive publishers such as Mono and Flux. For Cassandra, the main change is extending ReactiveCrudRepository instead of CrudRepository. section 13.0 section 13.3.2

A repository interface supplies the domain type and identifier type to ReactiveCrudRepository. Its methods expose publishers: findById() returns Mono, while findAll() returns Flux. Calling subscribe() starts a Flux pipeline. section 13.1.2

Reactive Cassandra repositories

IngredientRepository can extend ReactiveCrudRepository<Ingredient, String>, while OrderRepository can use ReactiveCrudRepository<TacoOrder, UUID> and add findByUserOrderByPlacedAtDesc(User user, Pageable pageable) returning Flux<TacoOrder>. Cassandra repository tests use @DataCassandraTest and StepVerifier-style reactive verification. section 13.3.3

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains interface inheritance, publisher return types, subscription, derived queries, and focused Cassandra tests without descending into repository internals.
Examples
Uses order, taco, and ingredient repositories, delivery-name printing, derived order queries, and Cassandra repository tests.
What it assumes
Assumes familiarity with repository interfaces and domain entities while teaching the reactive replacement for singular objects and Iterable collections.
What you can do after
Build reactive Cassandra repositories, compose Mono and Flux operations, subscribe to flows, and test them with Cassandra-focused slices.
How it connects
Connects ReactiveCrudRepository with CrudRepository, Mono, Flux, Spring Data Cassandra, Spring Data MongoDB, and reactive security services.

Related concepts

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