Getting started with QueueClassic title image

Getting started with QueueClassic

Any serious project nowadays needs background processing, right? Most of the Ruby community uses Sidekiq or Resque but there are other options. One is QueueClassic. QueueClassic uses PostgreSQL instead of Redis for Sidekiq.

Why should you use it?

Transactions: have you ever done this?

ruby # do stuff enqueuesomeemail("Hi, we sent you...") # rollback end

Too late, your mail is sent...but wait: not with QueueClassic! It is all in PostgreSQL which makes it more flexible.

Less moving parts: you already use PostgreSQL? No need to add anything!

Finally, it has a small code base making it easy for you to jump in and add features on top of it.

You have a Ruby app and PostgreSQL? You've got everything you need!


Add this to your Gemfile:

ruby gem "queue_classic"

Run bundle install

If you use Rails, run:

rails generate queue_classic:install bundle exec rake db:migrate

If you are NOT using Rails, run:

bundle exec rake qc:create

You will probably have to add require 'queue_classic' somewhere in your project.

Run a worker

Out of the box, the worker will run on the "default" queue. If you want to use the default, you only have to run:

bundle exec rake qc:work

That's it, you are ready to enqueue and process tons of jobs!

Enqueue jobs

One of the fun things with QueueClassic is that you don't have to create dedicated class with a specific structure or include any magic sauce, you can enqueue anything you want! Example:

ruby QC.enqueue("Kernel.puts", "Rainforest QA is amazing!")

In real life, you are most likely to create dedicated classes, but you get the point!

Little trick

By default, it will create a new database connection. If you want to share your ActiveRecord connection, just add this to an initializer:

ruby QC.defaultconnadapter =

Now that you are ready to enqueue jobs like crazy, what's next?

Here is a list of tools that were built on top of QueueClassic:

Play with it and feel the simplicity!

What is rainforest?

Rainforest is a unified platform for software testing. Quickly build no code QA tests that can be run with automated or crowd execution. Works across browsers, platforms, and mobile.