Resque Setup Development Mode
This tutorial will guide you setting up Resque locally in development mode with Multiple workers and how to use with Rails application to process background jobs.
What is Resque?
You might want to know what is Resque before we begin with commands/flow to set it up locally.
It uses Redis as a backend, thus you need to understand Redis architecture to know how resque-workers process background jobs.
Steps
- Install Redis
This is fine guide to help installing Redis
2. Start Redis server
This will start redis server for you and listen on port 6379
3. Create setup.rb initializers file
This will connect to redis server which was listening on port 6379
4. Start resque workers
This will start single working listening to all queues.
If you want to start multiple workers -
This will start 3 workers and will process jobs placed on any queue from your Rails application
Now whenever you enqueue jobs, these workers will process jobs in the background and you can see the logs for the same as well.
Let us know through comments if you face any difficulty setting up in development environment.
Subscribe to Ruby in Rails
Get the latest posts delivered right to your inbox