View Source Oban.Notifiers.Phoenix (Oban Notifiers Phoenix v0.1.0)
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.
Usage
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},
...