Did you know ... Search Documentation:
Predicate xlisten/5
 xlisten(+Redis, +Streams, +OnBroadCast, +OnIdle, +Options)[private]
Generalized version of xlisten/3 that is provided two callbacks: one to handle a message and one after each time the underlying XREAD or XREADGROUP has returned and the messages are processed. These callbacks are called as follows:
call(OnBroadCast, +Redis, +Stream, +MessageId, +Dict)
call(OnIdle, +Redis, +Streams, +Starts, +NewStarts, +Options)

Both callbacks must succeeds and not leave any open choice points. Failure or exception causes xlisten/5 to stop.