mkheck / flux-flix-intro

Streamlined introduction to reactive streams, Project Reactor, Spring Framework 5.x, & Spring Boot 2.x

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intro to FluxFlix

Maintainer

Purpose

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.

Prerequisites

  • MongoDB instance running & accessible using defaults

Helpful hints

Java-based service

  • 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

Kotlin-based service

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

Additional notes

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.

About

Streamlined introduction to reactive streams, Project Reactor, Spring Framework 5.x, & Spring Boot 2.x

License:MIT License


Languages

Language:Shell 43.0%Language:Batchfile 32.6%Language:Java 13.2%Language:Kotlin 11.1%