-
Mark Heckler
This project is intended to provide a streamlined introduction to reactive streams, in particular Project Reactor. While Project Reactor is not dependent upon the Spring Framework or Spring Boot, Spring Framework v5 and Spring Boot 2 are dependent upon Project Reactor. This demonstration app leverages all of the above in a somewhat (hopefully) typical application.
-
The flux-flix-service application, as it is currently configured, uses Spring WebMVC-style imperative/annotated code to create the defined REST endpoints.
-
To try defining the endpoints & routes in a functional reactive manner, simply:
-
Comment out the @RestController annotation in the MovieController class
-
Uncomment the @Configuration annotation in the FunctionalReactiveConfig class
-
Re-run the application
-
-
The FunctionalReactiveConfig class uses static imports to simplify the code (developer’s choice)
-
Lombok further reduces boilerplate for domain classes Movie and MovieEvent
-
Two different options are in the DataLoader class for examining either
-
movies as they are stored to the database
-
a listing of all movies in the database
-
Options for endpoint/route configuration are similar to the Java-based flux-flix-service notes above, to wit:
-
To try defining the endpoints & routes in a functional reactive manner, simply:
-
Comment out the @RestController annotation in the MovieController class
-
Uncomment the @Configuration annotation in the FunctionalReactiveConfig class
-
Re-run the application
-
-
With Kotlin, Lombok is no longer needed to reduce/eliminate boilerplate in domain classes
Feel free to clone the repo and play around with things. When you’re ready to add in security (reactive, of course) and/or dial up the complexity a bit, please check out Josh Long’s & my shared repo (linked below).
Feedback welcome.