π To block or not to block, that is the question.
Letβs suppose we have a stream of events and a pull consumer. The consumer has two methods to fetch: the first is gonna block until it receives something, and the second has a timeout to unblock. My personal rule of thumb is:
- if you need to synchronously consume a single event then process it: use the blocking one, as youβre using the stream like a FIFO queue.
- if you need to fetch βnβ events: use the non-blocking one, you might have no warranty that the stream contains (or is able to send) the expected amount of events.