3 ms·
You can trigger external actions by connecting PostgreSQL pubsub (LISTEN/NOTIFY) with an external job queue. https://postgrest.com/en/v0.4/intro.html#external-n
by begriffs 10y ago
You can trigger external actions by connecting PostgreSQL pubsub (LISTEN/NOTIFY) with an external job queue. https://postgrest.com/en/v0.4/intro.html#external-notification https://postgrest.com/en/v0.4/intro.html#external-notificati...
A NOTIFY SQL command can be sent out from either a stored procedure or a table trigger. (The docs could use some examples of this, but that's the idea.)
- gnud 10y agoBe aware that Postgres' NOTIFY is not stored/queued in any way. If your external client is not listening, it will get lost. I would instead have the trigger insert a row into a "pending tasks" table - and then send a NOTIFY.
- lima 10y agohttp://debezium.io/ http://debezium.io/ is a better way to do this. It uses the logical decoding feature to get all row changes and writes them to a Kafka queue. This means it can pick up where it left when it crashes.
- ruslan_talpa 10y agoalong the same lines https://github.com/confluentinc/bottledwater-pg https://github.com/confluentinc/bottledwater-pg