/spring-reactive-chat

Chat application built with Spring WebFlux

Primary LanguageJava

spring-reactive-chat

Chat application built with Spring WebFlux

Frontend built with Vue.js

Requirements

  • Java 8+
  • MongoDB 3.6+

Getting Started

The project makes use of MongoDB Change Streams to stream new chat messages via a Server-Sent Events endpoint.

Change Stream support is only possible for replica sets or for a sharded cluster.

Spring Data MongoDB Reference Documentation

Running a standalone MongoDB instance and calling the aforementioned endpoint will result in an exception:

com.mongodb.MongoCommandException: Command failed with error 40573 (Location40573): 'The $changeStream stage is only supported on replica sets' on server localhost:27017.

To convert your standalone MongoDB instance into a replica set, please refer to this guide. Also, consider persisting the replication.replSetName option in your mongod.conf configuration file.

Other than that, no manual configuration is necessary 😄

Building from Source

The project uses Gradle Wrapper and the Gradle Kotlin DSL.

To build the project use

./gradlew clean build

To run the project use

./gradlew bootRun

To run the project with an specific profile, e.g. prod, use

./gradlew bootRun -Pargs=--spring.profiles.active=prod

Note that the actual Spring arguments starting with -- are comma-separated:

./gradlew bootRun -Pargs=--spring.profiles.active=prod,--spring.main.banner-mode=off