Wraps Postgres pg_notify in core.async channels
(with-open [listener-cnxn (sql/get-connection @db)]
(let [sub (listen! (pg-listener ["my_channel"])
listener-cnxn)]
(sql/with-db-transaction [cnxn @db]
(pg-notify! cnxn "my_channel" "hello"))
(<!! sub)
;=> [{:channel "my_channel" :payload "hello"}]
))
For more advanced usage, see documentation on pg-listener
.
Copyright © 2015 Matt Savage
Distributed under the Eclipse Public License either version 1.0 or (at your discretion) any later version.