Coder Social home page Coder Social logo

reactive-apps's Introduction

Reactive Apps

A simple demo application showcases end-to-end Functional Reactive Programming (FRP) with Spring 5.

Reactive

Technology stack
  • Spring Framework 5
  • Spring Boot 2.0.0
  • Spring WebFlux
  • Embedded MongoDB
  • Reactive MongoDB Driver
  • Gradle 4
Highlights
  • Use of Server-Sent Events (SSE) rendered in HTML by Thymeleaf from a reactive data stream.
  • Use of Server-Sent Events (SSE) rendered in JSON by Spring WebFlux from a reactive data stream.
  • Use of Spring Data MongoDB's reactive (Reactive Streams) driver support.
  • Use of Spring Data MongoDB's support for infinite reactive data streams based on MongoDB tailable cursor (see here).
  • Use of Thymeleaf's fully-HTML5-compatible syntax.
  • Use of webjars for client-side dependency managements.
  • Reactive Netty as a server
  • Multi-project builds with Gradle Kotlin Script.
  • Kotlin as a language
  • Cross-Origin Resource Sharing (CORS)
  • Docker deployment

Prerequisites

  1. Gradle 4 (Install via sdkman)
  2. Docker for Mac Setup Instructions

Build

# build all 3 executable jars
gradle build
# continuous build with `-t`. 
# this shoud be started before any run tasks i.e., `gradle ui-app:bootRun`, for spring's devtools to work.
gradle -t build
# build all 3 apps
gradle build -x test -x shared:build
# build all 3 docker images
gradle docker -x test -x shared:build

Test

gradle test

Run

Manual

Start all 3 apps: mongo-data-service, stream-service, ui-app

If you want to debug the app, add --debug-jvm parameter to Gradle command line

Docker

You can also build Docker images and run all via Docker Compose

# start containers in the background
docker-compose up -d
# start containers in the foreground
docker-compose up 
# show runnning containers 
docker-compose ps
# scaling containers and load balancing
docker-compose scale stream=2
# 1. stop the running containers using
docker-compose stop
# 2. remove the stopped containers using
docker-compose rm -f
# start specific docker-compose file
docker-compose  -f docker-compose-all.yml up
# see logs of a service 
docker-compose -f docker-compose-all.yml logs  mongodb
# connect(ssh) to a service and run a command
docker-compose -f docker-compose-all.yml exec mongodb mongo -u "admin" -p "admin" --authenticationDatabase "admin"
# restart single service
docker-compose -f docker-compose-all.yml restart mongodb
# start single service
docker-compose -f docker-compose-all.yml up mongodb
# check health for a service
docker inspect --format "{{json .State.Health.Status }}" reactiveapps_app_1
docker ps

Access UI App at http://localhost:8080

Gradle Commands

# upgrade project gradle version
gradle wrapper --gradle-version 4.2-rc-2 --distribution-type all
# gradle daemon status 
gradle --status
gradle --stop

Credits

TODO

reactive-apps's People

Contributors

xmlking avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.