This project demonstrates a simple messaging application using Spring Boot, Redis Pub/Sub, and WebSocket for real-time message delivery.
- Publish messages via a web form.
- Messages are sent to a Redis channel.
- Messages are broadcast to all connected clients using WebSocket (STOMP).
- Live message updates on the UI.
For Development:
- Local Development: Follow the steps below for local setup with Gradle
- Docker: Use the Docker Deployment Guide for containerized development
- Kubernetes: Use the Kubernetes Guide for local Kubernetes clusters (kind/minikube)
For Production:
- Docker: Production-ready Docker deployment instructions in Docker Guide
- Kubernetes: Production configurations available in Kubernetes Guide
- CI/CD: Automated deployments with Jenkins Guide
- Java 17 or higher
- Gradle
- Redis server running on
localhost:6379
- Start your Redis server.
- Build and run the Spring Boot application:
./gradlew bootRun
- Open http://localhost:8445 in your browser.
- Usage: Enter a message in the form on the home page and submit.
- View Live Messages: Click "View Live Messages" to see messages appear in real time as they are published.
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Web Browser │ │ Spring Boot App │ │ Redis Server │
│ │ │ │ │ │
│ WebSocket │◄──►│ WebSocket │ │ Pub/Sub │
│ (STOMP) │ │ Controller │ │ Channel │
│ │ │ │ │ │
│ HTTP Forms │◄──►│ REST API │◄──►│ Message │
│ │ │ │ │ Queue │
└─────────────────┘ └──────────────────┘ └─────────────────┘
:8445 :8445 :6379
Message Flow:
- User submits message via web form (HTTP POST)
- Spring Boot app publishes message to Redis channel
- Redis notifies all subscribers (including the same app)
- App broadcasts message to all WebSocket clients
- Connected browsers display the message in real-time
- Redis connection settings are in
src/main/resources/application.properties. - WebSocket endpoint:
/ws - STOMP topic:
/topic/messages - Redis channel:
messageQueue
src/main/java/com/redis/config/RedisConfig.java— Redis and topic configuration.src/main/resources/templates/index.html— Message publishing form.src/main/resources/templates/messages.html— Live message view.src/main/resources/application.properties— Application configuration.
Dockerfile— Docker image configurationdocker-compose.yml— Multi-container Docker setupk8s/— Kubernetes deployment manifestsJenkinsfile— Jenkins CI/CD pipeline configuration
DOCKER_DEPLOYMENT_GUIDE.md— Docker deployment instructionsKUBERNETES_README.md— Kubernetes deployment guideJENKINS_DEPLOYMENT_GUIDE.md— Jenkins CI/CD setup guide
scripts/— Deployment and utility scripts for different platforms
This application can be deployed using multiple methods. Choose the one that best fits your environment:
| Deployment Method | Use Case | Complexity | Best For |
|---|---|---|---|
| 🐳 Docker | Development & Production | Low | Quick setup, local development, simple production |
| ☸️ Kubernetes | Production | Medium | Scalable production, microservices, cloud-native |
| 🚀 Jenkins CI/CD | Automated Deployment | High | Continuous integration, enterprise workflows |
For containerized deployment using Docker and Docker Compose:
- Docker Deployment Guide - Complete guide for Docker and Docker Compose deployment
- ✅ Quick setup with
docker-compose up - ✅ Perfect for development and testing
- ✅ Production-ready with proper configuration
For scalable deployment on Kubernetes clusters:
- Kubernetes Deployment Guide - Comprehensive Kubernetes deployment with development and production configurations
- ✅ Auto-scaling and load balancing
- ✅ Rolling updates and health checks
- ✅ Production-grade orchestration
For automated deployment and continuous integration:
- Jenkins CI/CD Pipeline Guide - Setup Jenkins for automated builds and deployments
- ✅ Automated testing and deployment
- ✅ Cross-platform support (Windows/Linux)
- ✅ Integration with Git workflows
- If you see unreadable characters in received messages, ensure
RedisTemplateusesStringRedisSerializerfor all serializers (already configured in this project). - Make sure Redis is running and accessible at the configured host and port.
This project is for educational purposes. All code is AI-generated.