What is a listener in pgpubsub
masterIn pgpubsub, a listener is a function that processes notifications sent through a specific channel.
To work correctly, listeners must follow these rules:
- They must be defined in your app's
listeners.pyfile. - They must be decorated using decorators from
pgpubsub.listen(e.g.,@pgpubsub.listeneror@pgpubsub.post_insert_listener). - The decorator associates the function with a specific channel, which also determines the function's expected signature.
- The function must be imported in your app's configuration class
ready()method (similar to Django signals) to ensure it is registered.