Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ability to listen for notifications from postgres #677

Merged
merged 3 commits into from
May 26, 2021

Conversation

jwoertink
Copy link
Member

This allows us to listen for pg_notify() calls for any number of channels.

SELECT pg_notify('workers', json_build_object('id', 1, 'name', 'test')::text)
AppDatabase.listen("workers") do |notify|
  data = JSON.parse(notify.payload)
  puts data["id"] #=> 1
  puts data["name"] #=> "test"
end

@jkthorne
Copy link
Contributor

I have been wanting to use this feature forever but have not found a good feature yet. I am excited this is being added to Avram/Lucky

@jwoertink
Copy link
Member Author

Yeah, I have a few upcoming uses for Lucky, so it's time to add it in!

Co-authored-by: Matthew McGarvey <matthewmcgarvey14@gmail.com>
@jwoertink jwoertink merged commit dcd0ee2 into master May 26, 2021
@jwoertink jwoertink deleted the features/listen branch May 26, 2021 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants