Challenge - 5 Problems
Redis Pub/Sub Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1:30remaining
What is the output of subscribing to a single channel?
You run the command
SUBSCRIBE news in Redis CLI. What will be the first message you receive?Redis
SUBSCRIBE news
Attempts:
2 left
💡 Hint
When you subscribe, Redis confirms the subscription first.
✗ Incorrect
The first message after subscribing is a confirmation message showing the subscription to the channel and the total number of subscriptions.
❓ query_result
intermediate1:30remaining
What happens when you subscribe to multiple channels?
You run
SUBSCRIBE sports weather. What is the output after subscribing?Redis
SUBSCRIBE sports weather
Attempts:
2 left
💡 Hint
Redis sends a confirmation for each channel subscribed, increasing the count.
✗ Incorrect
Redis sends a confirmation message for each channel. The first confirmation shows 1 total subscription, the second shows 2 total subscriptions.
📝 Syntax
advanced2:00remaining
Which command syntax correctly subscribes to channels with patterns?
You want to subscribe to all channels starting with 'news.'. Which command is correct?
Attempts:
2 left
💡 Hint
Pattern subscriptions use a special command starting with P.
✗ Incorrect
PSUBSCRIBE is used to subscribe to channels matching a pattern like 'news.*'.
🔧 Debug
advanced1:30remaining
Why does this subscription command fail?
You run
SUBSCRIBE without any channel names. What error do you get?Redis
SUBSCRIBE
Attempts:
2 left
💡 Hint
Redis commands require at least one channel name for SUBSCRIBE.
✗ Incorrect
SUBSCRIBE requires at least one channel argument; otherwise, it returns a wrong number of arguments error.
🧠 Conceptual
expert2:00remaining
What is the behavior of Redis SUBSCRIBE command regarding message delivery?
Which statement correctly describes how Redis delivers messages to subscribers?
Attempts:
2 left
💡 Hint
Think about how pub/sub works in real time.
✗ Incorrect
Redis delivers messages only to clients subscribed to the exact channel or matching pattern at the time of publishing. Messages are not stored for later delivery.