An Oban.Notifier that uses Phoenix.PubSub for notifications.
The Phoenix
notifier allows Oban to share a Phoenix application's PubSub
for notifications. In
addition to centralizing PubSub communications, it opens up the possible transports to all PubSub
adapters.
Most importantly, as Oban already provides Postgres
and PG
notifiers, this package enables
Redis notifications via the Phoenix.PubSub.Redis adapter.
This package requires a minimum of Oban v2.17 for a few enhancements:
defp deps do
[
{:oban_notifiers_phoenix, "~> 0.1"},
...
]
end
Make note of your application's Phoenix.PubSub
instance name from the primary supervision tree:
def start(_type, _args) do
children = [
{Phoenix.PubSub, name: MyApp.PubSub},
...
Finally, configure Oban to use Oban.Notifiers.Phoenix
as the notifier with the PubSub
intance name as the :pubusb
option:
config :my_app, Oban,
notifier: {Oban.Notifiers.Phoenix, pubsub: MyApp.PubSub},
...
Run mix test.ci
locally to ensure changes will pass in CI. That alias executes the following
commands:
- Check formatting (
mix format --check-formatted
) - Check unused deps (
mix deps.unlock --check-unused
) - Lint with Credo (
mix credo --strict
) - Run all tests (
mix test --raise
)