Migrate

From SolidQueue

Both are PostgreSQL ActiveJob adapters — swap the config and gain LISTEN/NOTIFY, DLQs, and recycling.

What changes#

SolidQueue and pgbus share an architecture — a supervisor/worker model, FOR UPDATE SKIP LOCKED polling, forked processes. Both are pure ActiveJob adapters, so your jobs work unchanged. pgbus adds LISTEN/NOTIFY for instant wake-up (SolidQueue only polls), dead-letter queues, worker recycling, and an event bus, and stores messages in PGMQ rather than custom tables.

Effort: low.

Swap the gem and adapter#

Gemfile
# Remove
gem "solid_queue"
gem "mission_control-jobs" # if used

# Add
gem "pgbus"
bundle install && rails generate pgbus:install && rails db:migrate
config/application.rb
config.active_job.queue_adapter = :pgbus # was :solid_queue
If you ran SolidQueue in a separate database via config.solid_queue.connects_to, the pgbus equivalent is config.connects_to — see Separate database.

Convert the worker config#

SolidQueue's processes: N forks N identical workers; in pgbus you list the same worker entry N times (one per process), or use the capsule DSL:

config/initializers/pgbus.rb
Pgbus.configure do |c|
  # SolidQueue: queues "critical", threads 5, processes 2
  c.workers = "critical: 5; critical: 5; default, low: 3"
  c.max_jobs_per_worker = 10_000
  c.max_memory_mb       = 512
end

Configuration mapping#

SolidQueuepgbusNotes
polling_intervalpolling_intervalDefaults to 0.1s; LISTEN/NOTIFY makes it a fallback.
threadsthreadsSame concept.
processes: NRepeat the worker entryOne entry per forked process.
queues: "a,b"queues: [a, b]Array, not a comma string.
queues: "*"List queues explicitlyPGMQ queues are explicit.
SolidQueue's limits_concurrency has a near-identical pgbus API (auto-included, no explicit require). See Concurrency & uniqueness; recurring.yml maps to Recurring tasks.

What you gain#

  • LISTEN/NOTIFY — instant wake-up instead of polling latency.
  • Dead-letter queues — SolidQueue has none; pgbus routes exhausted jobs to a _dlq queue.
  • Worker recycling — memory, job-count, and lifetime limits.
  • An event bus — pub/sub with topic routing, on the same infrastructure.