Demo project with Spring Webflux, MongoDB and Node.js Publisher
Branches in the repository show different implementation variants:
main
: Webflux backend + Server-Sent Events (SSE) + Thymeleaf clientwebsockets-based-implementation
: Webflux backend + Websockets + Thymeleaf clientgraphql-api-with-subscription
: Webflux backend + Subscription via GraphQL-APIvue-frontend
: Webflux backend + Server-Sent Events (SSE) + Vue.js client
-
Install MongoDB according to the documentation: https://docs.mongodb.com/manual/administration/install-community/
-
A DB
webflux-demo
with a capped collectionsensors
is expected (size 500000 bytes) → create if necessary (e.g. via MongoDB Compass)
Start the node script mockSensor/index.js
→ the script continuously fills the database with "sensor data" until it is terminated
The backend works with Spring Webflux, Netty and Thymeleaf. It can be started via the class /webflux-demo/src/main/java/en/fhdo/webfluxdemo/SensorDataApp.java
or via mvn spring-boot:run
.
- Start mock sensor and Webflux backend
- Test server-side rendered view: http://localhost:8080/sensor/list
- Test REST-API:
curl -H "Accept: text/event-stream" http://localhost:8080/sensor/api/temperature
No data records can be deleted from capped collections, so the collection must be dropped and recreated!