Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
debezium
Change data capture for a variety of databases. Please log issues at https://issues.redhat.com/browse/DBZ.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
If you want to stay in the Elixir world, I’ve created WalEx which listens to the Postgres WAL similar to Debezium and doesn’t suffer from scale issues of the trigger notify approach:
https://github.com/cpursley/walex
Phoenix.PubSub is basically a noop service. It really just works. You should try it!
If discovering nodes is difficult in your env, try using a listen/notify libcluster strategy:
https://github.com/supabase/supavisor/blob/main/lib/cluster/...
I believe #2 was the main driver for the supabase team to build their real-time component: https://github.com/supabase/realtime
Background/announcement: https://supabase.com/blog/supabase-realtime-multiplayer-gene...
For #1 I've been keeping a keen eye on pgcat [1], in particular the https://github.com/postgresml/pgcat/issues/303 which
If you want to listen to database changes in Elixir you can also get really good stuff done by using Cainophile (https://github.com/cainophile/cainophile). Same mechanism. I don't know the details of Debezium so I can't say if you are leaving fantastic things on the table. But I've had good fun with Cainophile. For example I've used it in my videos on Electric SQL to react to changes in a Postgres database. It matches nicely with realtime-ish UI via LiveView. So meshes really good with the current Elixir stack.
https://github.com/bnchrch/postgrex_pubsub
And But it you want something even better I recommend WalEx
We made mssql-changefeed for this purpose:
https://github.com/vippsas/mssql-changefeed
V1 requires to run a sweeper procedure in the background, but an upcoming v2 version does without the sweep loop. Unfortunately too fresh for readme to be updated, but relevant lines in tests to show it off:
https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/go/...
https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/go/...
https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/go/...
Library itself:
https://github.com/vippsas/mssql-changefeed/blob/v1-lazy/mig...