Redis Clustering
Redis Clustering
Section titled “Redis Clustering”Cross-node broadcasting via Redis pub/sub. Messages broadcast on one node are delivered to clients on all nodes.
Maven Coordinates
Section titled “Maven Coordinates”<dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-redis</artifactId> <version>LATEST</version> <!-- check Maven Central for latest --></dependency>Quick Start
Section titled “Quick Start”Configure the broadcaster class and Redis connection:
org.atmosphere.cpr.broadcasterClass=org.atmosphere.redis.RedisBroadcasterorg.atmosphere.redis.url=redis://localhost:6379Or use RedisClusterBroadcastFilter with the default broadcaster:
org.atmosphere.cpr.broadcastFilterClasses=org.atmosphere.redis.RedisClusterBroadcastFilterorg.atmosphere.redis.url=redis://localhost:6379Spring Boot
Section titled “Spring Boot”atmosphere: broadcaster-class: org.atmosphere.redis.RedisBroadcaster init-params: org.atmosphere.redis.url: redis://localhost:6379Configuration
Section titled “Configuration”| Property | Default | Description |
|---|---|---|
org.atmosphere.redis.url | redis://localhost:6379 | Redis connection URL |
org.atmosphere.redis.password | (none) | Optional password |
How It Works
Section titled “How It Works”RedisBroadcaster extends DefaultBroadcaster and publishes every broadcast message to a Redis channel. Each node subscribes to the same channel and delivers incoming messages to its local clients. A node ID header prevents echo (re-broadcasting messages that originated locally).
Key Classes
Section titled “Key Classes”| Class | Purpose |
|---|---|
RedisBroadcaster | Broadcaster that publishes/subscribes via Redis pub/sub |
RedisClusterBroadcastFilter | ClusterBroadcastFilter for use with DefaultBroadcaster |
See Also
Section titled “See Also”- Kafka Clustering
- Core Runtime — Broadcaster API