View Source Oban.Notifiers.Postgres (Oban v2.12.0)

A Postgres Listen/Notify based Notifier.

usage

Usage

Specify the Postgres notifier in your Oban configuration:

config :my_app, Oban,
  notifier: Oban.Notifiers.Postgres

caveats

Caveats

The notifications system is built on PostgreSQL's LISTEN/NOTIFY functionality. Notifications are only delivered after a transaction completes and are de-duplicated before publishing. Typically, applications run Ecto in sandbox mode while testing, but sandbox mode wraps each test in a separate transaction that's rolled back after the test completes. That means the transaction is never committed, which prevents delivering any notifications.

To test using notifications you must run Ecto without sandbox mode enabled, or use Oban.Notifiers.PG instead.

Link to this section Summary

Functions

Register current process to receive messages from some channels

Start the notifier.

Unregister current process from channels

Link to this section Functions

Link to this function

listen(server, channels)

View Source
@spec listen(GenServer.server(), channels :: [Oban.Notifier.channel()]) :: :ok

Register current process to receive messages from some channels

@spec start_link(Keyword.t()) :: GenServer.on_start()

Start the notifier.

Link to this function

unlisten(server, channels)

View Source
@spec unlisten(GenServer.server(), channels :: [Oban.Notifier.channel()]) :: :ok

Unregister current process from channels