Replay events on Redis Streams

Im evaluating to use redis streams as a event store for my application, but Im not sure how to implement the replay funcionality out-of-the-box, btw I dont even know if it is possible to do.

I tested the replay with the following commands but I was unable to identify the side effects of this approach.

1. > XADD mystream * key1 value1
2. "1612993364265-0"

3. > XADD mystream 1612993364265-1 key1 value1 # only change the logical part
4. "1612993364265-1"

* > XINFO STREAM mystream
5. 1) "length"
6. 2) (integer) 2
7. 3) "radix-tree-keys"
8. 4) (integer) 1
9. 5) "radix-tree-nodes"
10. 6) (integer) 2
11. 7) "last-generated-id"
12. 8) "1612993364265-1"
13. 9) "groups"
14. 10) (integer) 0
15. 11) "first-entry"
16. 12) 1) "1612993364265-0"
17. 2) 1) "key1"
18. 2) "value1"
19. 13) "last-entry"
20. 14) 1) "1612993364265-1"
21. 2) 1) "key1"
22. 2) "value1"

To replay a stream from the beginning, just use a series of XREAD calls (XREAD – Redis).

To get 100 entries starting from the beginning:

XREAD COUNT 100 STREAMS mystream 0-0

To get 100 entries starting from 1612993364265-1:

XREAD COUNT 100 STREAMS mystream 1612993364265-1