DB/Redis

Messaging with Redis

doriver 2025. 2. 9. 14:40

 

레디스 pub/sub 메시징시스템

This guide walks you through the process of using Spring Data Redis to publish and subscribe to messages sent with Redis.

uses ' StringRedisTemplate ' to publish a string message 
and has a POJO subscribe for the message by using ' MessageListenerAdapter '
( Plain Old Java Object )

Redis provides not only a NoSQL data store 
but a messaging system as well.

 

 

spring-boot-docker-compose의존성이 있으면 스프링에서 실행되는거

Search for a compose.yml and other common compose filenames in your working directory
Call docker compose up with the discovered compose.yml
Create service connection beans for each supported container
Call docker compose stop when the application is shutdown

 

 

Create a Redis Message Receiver

In any messaging-based application
, there are message publishers and messaging receivers


Register the Listener and Send a Message

Spring Data Redis provides all the components you need to send and receive messages with Redis. 

Specifically, you need to configure:
A connection factory
A message listener container
A Redis template

 

 

https://spring.io/guides/gs/messaging-redis

 

Getting Started | Messaging with Redis

To run the code without Spring Boot Docker Compose support, you need a version of Redis running locally. To do this, you can use Docker Compose, but you must first make two changes to the compose.yaml file. First, modify the ports entry in compose.yaml to

spring.io