Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Whats the best practice way to initialise a Redis pub/sub subscriber in a Rails app when it starts up?

$
0
0

I have a collection of Rails apps, and I want to have some of them subscribe to a channel waiting for messages. They are all connected to the same Redis server already, but I'm just not sure where to place the code that starts the subscriber to listen for messages.

Should I have a class in config/initializers that starts a new thread and calls the redis.subscribe method?

Should I perform a Resque job from an initializer class that is in its own dedicated queue and has its own dedicated worker which then calls the redis.subscribe?

Are there other ideas of how I should do this? Or does this just not makes sense overall?

I haven't full tried either yet, I have just been fumbling around looking for recommendations.


Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>