sewenew/redis-plus-plus

[QUESTION] Any loss of message in time between sub.consume and callback

Closed this issue · 2 comments

when the message is received, Subscriber::consume calls the callback function to process the messages,
during this time, will sub.consume() continue to receive the message without losing any messages?
Assume the callback takes longer time to return, even during this time, messages arriving on channels are in queue and its not dropped?
consume() returns after consume() calls the callback on receiving the message. from the time consume() returns and till next consume, what happens to the messages?

Subscriber::consume() does 2 things:

  1. receive message from Redis
  2. then call the registered callback

Receiving message and running callback are not run in parallel.

Client does not receive new message until consume finishes the callback and returns. Only when you call consume again (normally in a loop), client receives new messages. So there's no messages lost.

Regards

Please also refer to the following thread and comment, regarding the Subscriber class' thread safety:
#289 (comment)