An proof of concept for Postgres notify - listen functionality, in this case - every insert will trigger notification.
Basically whole thing is set of 3 commands:
db:init
- that will setup database, triggers and notifying functionchannel:listen
- channel listenerchannel:send
- sends notification by inserting new row
Docker example:
docker-compose up listener sender