Challenge - 5 Problems
Redis Pub/Sub and Streams Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Difference in message delivery guarantees
Which statement correctly describes the message delivery guarantee difference between Redis Pub/Sub and Redis Streams?
Attempts:
2 left
💡 Hint
Think about what happens if a subscriber is offline when a message is published.
✗ Incorrect
Redis Streams store messages so consumers can read them later, ensuring delivery even if offline. Pub/Sub sends messages only to currently connected subscribers.
❓ query_result
intermediate2:00remaining
Output of a Pub/Sub message reception
Given a Redis Pub/Sub subscriber listening on channel 'news', what will be the output if a publisher sends the message 'Hello' to 'news' while the subscriber is connected?
Redis
SUBSCRIBE news PUBLISH news Hello
Attempts:
2 left
💡 Hint
Consider the format Redis uses to notify subscribers.
✗ Incorrect
Redis Pub/Sub sends messages with a pattern like 'message channel message'. Here, the subscriber receives 'message news Hello'.
📝 Syntax
advanced2:00remaining
Correct command to add an entry to a Redis Stream
Which Redis command correctly adds a new entry with field 'user' and value 'alice' to a stream named 'mystream'?
Attempts:
2 left
💡 Hint
The XADD command uses '*' to auto-generate the entry ID.
✗ Incorrect
The correct syntax is XADD mystream * field value. Option D follows this format.
❓ optimization
advanced2:00remaining
Choosing between Pub/Sub and Streams for offline consumers
You want to build a chat application where users can receive messages sent while they were offline. Which Redis feature should you choose for message delivery and why?
Attempts:
2 left
💡 Hint
Think about which feature stores messages for later reading.
✗ Incorrect
Redis Streams store messages so consumers can read them later, supporting offline message delivery. Pub/Sub does not store messages.
🔧 Debug
expert2:00remaining
Why does a Redis Pub/Sub subscriber miss messages?
A Redis Pub/Sub subscriber sometimes misses messages published to a channel. What is the most likely reason?
Attempts:
2 left
💡 Hint
Consider how Pub/Sub handles offline subscribers.
✗ Incorrect
Redis Pub/Sub delivers messages only to connected subscribers. If a subscriber is offline, it misses messages.