Perhaps queueing libraries are the new test frameworks. You’ll get no complaints from me. I for one welcome some choice in picking the right solution for backgrounding jobs. We just covered Qu just last week, and this week we’d like to spotlight Queue Classic from Ryan Smith. Queue Classic aims to exploit some distinct features of PostgreSQL to build a database-backed queueing library.
As Ryan notes in the README
I was already using PostgreSQL to manage my application’s data, why not use PostgreSQL to pass some messages? PostgreSQL was already handling thousands of reads and writes per second anyways. Why not add 35 more reads/writes per second to my established performance metric? queue_classic handles over 3,000,000 jobs per day. It does this on Heroku’s Ronin Database.
His blog post elaborates on his philosophy of using a database as a queue and what makes PostgreSQL a good fit.
For basic usage as well as tips and tricks, don’t miss the documentation that includes plenty of code examples:
@queue = QC::Queue.new("priority_jobs") @queue.enqueue("Class.method", "arg1")