# Qujo The basic idea behind Qujo came from a simple idea: > Store information about jobs in my application domain database, rather than in Redis Qujo wraps a Resque worker with a model class and some basic intelligence around executing jobs and storing their output. It also provides a logger for Jobs, retry functionality, Rails integration, Bootstrap integration, polling javascript for displaying the running jobs and workers in a page within your app. ## Databases Currently, Qujo only works for Mongoid. It doesn't lend well to ActiveRecord-based models, as it talks to the database a lot (probably more than it should). ## Queue support I've started some work seeing if I can get Qujo to work with Sidekiq, but I'm not sure it's worth the effort. Sidekiq stands much better on it's own, having solved some of the problems that I experienced with Resque. Though you still have to look somewhere else for errors and stack traces. ## Setup Add Qujo to your Gemfile ``` gem 'qujo' ``` ### Create an initializer for Rails ```Ruby # config/initializers/qujo.rb require 'qujo/queue/resque' # we're using Resque require 'qujo/database/mongoid' # we're using Mongoid Qujo.configure do |config| # use Yell for our logger config.logger = Yell.new do |l| l.level = [:info, :warn, :error, :fatal] l.adapter :file, File.join(Rails.root, "log", "qujo.log") end end ``` ### Create a Job model The following Job model is the parent of all Jobs that do the actual work. ```Ruby # app/models/job.rb class Job include Qujo::Database::Mongoid include Qujo::Queue::Resque include Qujo::Concerns::Common include Qujo::Concerns::Logging include Qujo::Concerns::Status # any custom functionality shared for all jobs end ``` ### Mount the Qujo engine ```Ruby # config/routes.rb MyApp::Application.routes.draw do # ... normal routes mount Qujo::Engine => "/" end ``` After this is configured, you can view the jobs at `localhost:3000/jobs`. ### Bootstrap If you're using bootstrap, there is a Qujo template to integrate some status information into your bootstrap navigation. ```