Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis pub/sub for single receivers

I am a RabbitMQ user exploring Redis and have two questions regarding the pub/sub mechanism

  1. Can I publish messages to the system where each client (consumer) removes the entry for other clients? I want to publish 100 tasks but each tasks should be processed only by 1-single subscriber.

  2. AFAIK, by default all messages are always broadcasted/published to all clients. What if one client takes 1 second to process the message, and another takes a minute. What would be the limits here? Would be some messages dropped at some point?

Thanks a lot!

like image 704
Daniel Stephens Avatar asked Sep 15 '25 09:09

Daniel Stephens


1 Answers

1) That's not how pub/sub works. Publish doesn't care or know about being received, it just publishes a message. Every subscriber that is subscribed will receive it and you can't stop this

2) That's up to you to handle client logic.

From the sounds of it, redis pub/sub might not be the system/pattern you're looking for. You should look into zeromq especially, push and pull sockets, which instead of publishing messages, push messages to specific sockets one time. If you read through the starter documentation many patterns are explained and something will work for your specific case.

like image 187
Christopher Reid Avatar answered Sep 17 '25 23:09

Christopher Reid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!