https://github.com/jonathan-foucher/spring-boot-redis-topic-example
An example of Redis pub/sub on Spring Boot
https://github.com/jonathan-foucher/spring-boot-redis-topic-example
java redis-pubsub spring-boot valkey
Last synced: 4 months ago
JSON representation
An example of Redis pub/sub on Spring Boot
- Host: GitHub
- URL: https://github.com/jonathan-foucher/spring-boot-redis-topic-example
- Owner: jonathan-foucher
- Created: 2024-07-06T13:54:33.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2025-11-23T13:33:56.000Z (7 months ago)
- Last Synced: 2025-11-23T15:17:58.808Z (7 months ago)
- Topics: java, redis-pubsub, spring-boot, valkey
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Introduction
This project is an example of Redis / Valkey pub/sub implementation with Spring Boot.
An endpoint allows to post a job in the queue and the subscriber will automatically consume it.
The publisher and subscriber are both set on the same project on this example.
Note that all the jobs will run in parallel when the message is received by the subscriber.
If you need to wait for the current job to end before launching the next one, Redis / Valkey Stream might be a better solution and you can check [this project](https://github.com/jonathan-foucher/spring-boot-redis-stream-example).
## Run the project
Valkey is a free open-source project forked from Redis.
If you prefer, you can choose to run Redis instead.
You will need to launch a Valkey instance on your computer before running the project.
You can either install Valkey directly on your machine or run it through Docker :
`docker run -p 6379:6379 valkey/valkey`
Once Valkey is launched, you can start the Spring Boot project and start posting HTTP requests on the endpoint:
```
curl --request POST \
--url http://localhost:8080/redis-topic-example/v1/jobs/start \
--header 'Content-Type: application/json' \
--data '{"id": 1, "name": "some job name"}'
```