Skip to content

Instantly share code, notes, and snippets.

@KamilLelonek
Last active September 20, 2018 13:40
Show Gist options
  • Save KamilLelonek/51c487eeb62e201889af2dd06341bc71 to your computer and use it in GitHub Desktop.
Save KamilLelonek/51c487eeb62e201889af2dd06341bc71 to your computer and use it in GitHub Desktop.
defmodule PostgresPubSub.Listener do
# ...
require Logger
@impl true
def handle_info({:notification, _pid, _ref, "accounts_changed", payload}, _state) do
with {:ok, data} <- Poison.decode(payload, keys: :atoms) do
data
|> inspect()
|> Logger.info()
{:noreply, :event_handled}
else
error -> {:stop, error, []}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment