View Source Oban.Notifiers.PG (Oban v2.11.0)

A PG/PG2 based notifier implementation that runs with Distributed Erlang.

Out of the box, Oban uses PostgreSQL's LISTEN/NOTIFY for PubSub. For most applications, that is fine, but Postgres-based PubSub isn't sufficient in some circumstances. In particular, Postgres notifications won't work when your application connects through PGbouncer in transaction or statement mode.

Note: You must be using Distributed Erlang to use the PG notifier.

Usage

Specify the PG notifier in your Oban configuration:

config :my_app, Oban,
  notifier: Oban.Pro.Notifiers.PG,
  ...

Implementation Notes

  • The notifier will use pg if available (OTP 23+) or fall back to pg2 for older OTP releases.

  • Like the Postgres implementation, notifications are namespaced by prefix.

  • For compatbility, message payloads are always serialized to JSON before broadcast and deserialized before relay to local processes.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.