Block until Complete Count

749 views Asked by At

I am using Redis streams and need to block my clients until there are at least say X number of messages in the stream and return when it reaches that X count.. Is there any way to achieve this?

EG: XREADGROUP GROUP G1 C2 COUNT 10 BLOCK 0 STREAMS L > until all 10 messages have arrived in the stream key

1

There are 1 answers

1
Eugene Yarmash On BEST ANSWER

COUNT specifies the maximum number of elements to return per stream, if there are any. If the streams are empty (and the BLOCK option was used), the consumer blocks. Once there's a single incoming message, the blocking is released with that message. So no, you can't block until COUNT messages are read. But you can probably group messages on the application level.

See XREAD for more details.