Call me back, Postgres
summary
Shows that Postgres triggers + listen/notify replace fragile ActiveRecord callbacks and polling for cross‑consumer sync by putting callbacks in the database, emitting PG_NOTIFY payloads, and running a separate Ruby listener with wait_for_notify. Describes writing SQL functions and migrations (structure.sql), a trigger log pending→synced retry pattern, and tactics to avoid loops such as disable triggers during sync. Implements as a Heroku dyno/rake worker and reports it works for a Salesforce/Heroku Connect/legacy PHP integration.
AI-written summary · about
chapters (12)
- 0:00Start
- 1:42Main Players
- 3:16Key Connections
- 10:03PG Triggers
- 11:19Define a Function
- 12:56Apply Trigger Function
- 19:12Using Rails Migrations
- 21:42Syncing Process Design
- 22:42Maintaining a Connection
- 23:49Logging Triggers
- 25:37Avoiding Continuous Trigger Loops
- 27:53Solving for Edge Cases
related talks
44mPushy Postgres and Python
34mBeyond CRUD: the PostgreSQL techniques your Rails app is missing.
26mLISTEN Carefully: How NOTIFY Can Trip Up Your Database
43mJust Use Postgres.
46mUse PostgreSQL, not Rails, to make Rails Faster!
23mPostgres as a Message Broker
26mSkip the Queue! Event-Driven Apps for Everyone with Postgres!
51mWhen Postgres Can't, You Can!
