Getting started

Overview

pgbus is PostgreSQL-native job processing and an event bus for Rails, built on PGMQ. Jobs, events, and live updates all run in the database you already have.

One database, no Redis#

The whole point.

Most Rails job backends bolt on infrastructure: Sidekiq needs Redis, and turbo-rails broadcasts need Action Cable (and Redis again). pgbus needs one PostgreSQL — the database your app already runs — and layers jobs, a pub/sub event bus, and Server-Sent-Event streams on top of PGMQ, a lightweight message-queue extension.

That means one thing to provision, one thing to back up, one thing to monitor. Enqueues participate in your database transactions. And the durability guarantees are Postgres's, not a separate broker's.

PGMQ can run as a PostgreSQL extension or as vendored, embedded SQL (no extension required). See Installation for the schema modes.

What you get#

  • A drop-in ActiveJob adapter — set the adapter to :pgbus and your existing jobs enqueue through PGMQ, with dead-letter routing and retry backoff you didn't have to write.
  • An event bus — publish once; AMQP-style topic patterns (orders.#, payments.*) fan out to idempotent subscribers, deduplicated by event id.
  • Workers that recyclemax_jobs_per_worker, max_memory_mb, and max_worker_lifetime retire a worker before it leaks, fixing the memory-bloat problem other backends leave to you.
  • Reliability primitives — dead-letter queues, a circuit breaker, job uniqueness, concurrency limits, priority queues, and a transactional outbox.
  • Real-time streams — a Turbo Streams transport over Postgres SSE, with no Action Cable and no lost messages on reconnect.
  • A live dashboard — queues, jobs, processes, failures, and dead letters, auto-refreshing over Turbo Frames (no WebSocket).

How it compares#

Against the common Rails job backends.

FeatureSidekiqSolidQueueGoodJobpgbus
InfrastructureRedisPostgreSQLPostgreSQLPostgreSQL (PGMQ)
ActiveJob adapterYesYesYesYes
LISTEN/NOTIFYN/APolling onlyYesYes
Dead letter queuesRetries onlyNoNoYes
Worker recyclingNoNoNoYes
Event busNoNoNoYes
Idempotent eventsNoNoNoYes
Concurrency controlsEnterpriselimits_concurrencyYesPgbus::Concurrency
Recurring / cron jobssidekiq-cronrecurring.ymlYesBuilt in — recurring tasks
BatchesProNoGoodJob::BatchPgbus::Batch
Web dashboardYesMission ControlYesPgbus::Engine
Turbo Streams transportCable (Redis)CableCableBuilt-in SSE
Lost messages on reconnectYesYesYesNo (msg_id cursor)
Transactional broadcastsNoNoNoYes (until commit)
Coming from another backend? The migration guides cover what changes and what stays the same: Sidekiq, SolidQueue, GoodJob.

Where to next#