0
0
Redisquery~10 mins

Pub/sub vs streams comparison in Redis - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to subscribe to a Redis channel named 'news'.

Redis
SUBSCRIBE [1]
Drag options to blanks, or click blank then click option'
Anews
Bstream
Cchannel1
Dmessages
Attempts:
3 left
💡 Hint
Common Mistakes
Using a stream name instead of a channel name
Misspelling the channel name
2fill in blank
medium

Complete the code to add a message to a Redis stream named 'mystream'.

Redis
XADD mystream * [1] message
Drag options to blanks, or click blank then click option'
Atopic
Bchannel
Cfield1
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using channel or topic which are for pub/sub
Omitting the field name
3fill in blank
hard

Fix the error in the command to read messages from a stream 'mystream' starting from the last ID.

Redis
XREAD COUNT 10 STREAMS mystream [1]
Drag options to blanks, or click blank then click option'
A0
B-
C*
D$
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0' to read only new messages
Using '*' which is invalid here
4fill in blank
hard

Fill both blanks to publish a message 'Hello' to channel 'chatroom' and add the same message to stream 'chatstream'.

Redis
PUBLISH [1] 'Hello'
XADD [2] * message 'Hello'
Drag options to blanks, or click blank then click option'
Achatroom
Bchatstream
Cnews
Dmystream
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up channel and stream names
Using the wrong command for each data type
5fill in blank
hard

Fill all three blanks to create a consumer group 'group1' for stream 'orders', read new messages, and acknowledge message ID '1526985058136-0'.

Redis
XGROUP CREATE [1] [2] $ MKSTREAM
XREADGROUP GROUP [1] consumer1 COUNT 10 STREAMS [2] >
XACK [2] [1] 1526985058136-0
Drag options to blanks, or click blank then click option'
Agroup1
Borders
Cgroup2
Dmystream
Attempts:
3 left
💡 Hint
Common Mistakes
Using different group or stream names in commands
Not acknowledging messages properly