Support LISTEN/NOTIFY callback handlers
I'd like to be able to add a callback handler similar to asyncpg's connection.add_listener(...)
I'm agnostic on the API, if there is a more idiomatic PSQLPy abstraction or interface that's cool—I just think it would be great to have the LISTEN/NOTIFY functionality exposed
Thanks for the feature request, we'll implement it.
@oliverlambson Hello!
If it's possible could you please describe how you usually use this functionality?
I use it to send notifications like events that a listener can then react to.
Being able to do that means I can implement an asynchronous message queue. I've implemented it from scratch in https://www.github.com/oliverlambson/pgmq (there are explanations there if it's helpful), and as a taskiq plugin https://www.github.com/karoo-ca/taskiq-pg
Okay, thank you very much
I've started implementing it but it'll be different in API from asyncpg.
Exciting!
@oliverlambson Hello!
I've made a new release 0.9.0 with support for LISTEN functionality. It's the first variant of API, so if you have any ideas on how to make it better, please let me know.
You can read new documentation about it here - https://psqlpy-python.github.io/components/listener.html