0
0
Redisquery~30 mins

Pub/sub limitations (no persistence) in Redis - Mini Project: Build & Apply

Choose your learning style9 modes available
Understanding Redis Pub/Sub Limitations: No Persistence
📖 Scenario: You are building a simple chat application using Redis Pub/Sub. You want to understand how messages are delivered and what happens if a user is offline.
🎯 Goal: Create a Redis Pub/Sub setup that demonstrates message publishing and subscribing, and observe the limitation that messages are not stored if the subscriber is offline.
📋 What You'll Learn
Create a Redis channel named chatroom
Subscribe to the chatroom channel
Publish messages to the chatroom channel
Demonstrate that messages sent while subscriber is offline are not received
💡 Why This Matters
🌍 Real World
Many chat apps and real-time systems use Redis Pub/Sub for instant messaging but must handle the limitation that messages are not saved if users are offline.
💼 Career
Understanding Redis Pub/Sub limitations is important for backend developers and system architects designing real-time communication systems.
Progress0 / 4 steps
1
Create a Redis channel named chatroom
Write the Redis command to create a channel named chatroom by subscribing to it using the command SUBSCRIBE chatroom.
Redis
Need a hint?

Use the SUBSCRIBE command followed by the channel name chatroom.

2
Publish a message to the chatroom channel
Write the Redis command to publish the message Hello everyone! to the chatroom channel using PUBLISH chatroom "Hello everyone!".
Redis
Need a hint?

Use the PUBLISH command with the channel name and the message in quotes.

3
Simulate subscriber offline and publish a message
Write the Redis command to publish the message Are you there? to the chatroom channel while no subscriber is connected, using PUBLISH chatroom "Are you there?".
Redis
Need a hint?

Use the PUBLISH command again with the new message.

4
Explain the limitation of Redis Pub/Sub with no persistence
Add a comment explaining that Redis Pub/Sub does not store messages, so if a subscriber is offline, it will miss messages published during that time.
Redis
Need a hint?

Write a comment starting with # explaining the no persistence limitation.