Simple ActiveJob worker for PostgreSQL using LISTEN/NOTIFY and SKIP LOCKED.
Supports most ActiveJob features like multiple queues, priorities and wait times.
Needs PostgreSQL 9.5 to use SKIP LOCKED.
Just schedule your work with ActiveJob, then run one or multiple workers for the default queue with
$ bin/rails runner PgJobs.work
or for other queues with
$ bin/rails runner "PgJobs.work(:my_queue)"
Add this line to your application's Gemfile:
gem 'pg_jobs'
And then execute:
$ bundle
Then copy the migrations and migrate your database:
$ bin/rails railties:install:migrations
$ bin/rails db:migrate
To configure the ActiveJob adapter add this to your environment configuration (config/environments/production.rb):
config.active_job.queue_adapter = :pg_jobs
Use Github issues and pull requests.
The gem is available as open source under the terms of the MIT License.