0
0
Redisquery~10 mins

Why streams handle event logs in Redis - Test Your Understanding

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

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

Redis
XADD mystream * event [1]
Drag options to blanks, or click blank then click option'
Astart
Bstart_time
Cstart_event
Dstart_value
Attempts:
3 left
💡 Hint
Common Mistakes
Using a complex or incorrect event name.
Forgetting the asterisk (*) for automatic ID generation.
2fill in blank
medium

Complete the code to read the latest event from the Redis stream 'mystream'.

Redis
XREVRANGE mystream + - COUNT [1]
Drag options to blanks, or click blank then click option'
A5
B10
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using COUNT 0 which returns no events.
Using a large COUNT when only one event is needed.
3fill in blank
hard

Fix the error in the command to read events from 'mystream' starting from ID '0-0'.

Redis
XRANGE mystream [1] +
Drag options to blanks, or click blank then click option'
A0
B0-0
C-
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0' instead of '0-0' as the start ID.
Using '-' or '*' which are not valid start IDs.
4fill in blank
hard

Fill both blanks to create a consumer group named 'mygroup' for the stream 'mystream' starting from the beginning.

Redis
XGROUP CREATE mystream [1] [2]
Drag options to blanks, or click blank then click option'
Amygroup
B0
C0-0
D$
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0' instead of '0-0' as the starting ID.
Using '$' which starts from the latest event.
5fill in blank
hard

Fill all three blanks to read new messages from 'mystream' for consumer 'consumer1' in group 'mygroup'.

Redis
XREADGROUP GROUP [1] [2] COUNT 1 STREAMS mystream [3]
Drag options to blanks, or click blank then click option'
Amygroup
Bconsumer1
C>
D0-0
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0-0' instead of '>' which reads all messages from the start.
Mixing up group and consumer names.