Last active
September 20, 2018 13:40
-
-
Save KamilLelonek/51c487eeb62e201889af2dd06341bc71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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