cheerfulstoic
I’ve created a library that allows you to get notified about PostgeSQL inserts, updates, and deletes as Phoenix PubSub messages in your Elixir app. You might find this useful, for example, when updating caches or sending notifications about record updates.
See the README for more details and examples:
Trending in Announcing
WebAuthnLiveComponent WebAuthnComponents
See this post about renaming the package.
Passwordless authentication for Phoenix LiveView app...
New
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I released Doggo, a collection of unstyled Phoenix components.
https://github.com/woylie/doggo
Features
Unstyled Phoenix components....
New
Hi everyone,
I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
I’ll shortly be launching Text, a nascent text analysis library.
Current functionality
In this early version (not ready for prime time) ...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
c4710n
Thank you for providing a more general and complete solution for pg_notify. The DX is good. Really like it.
akramic
This is really useful - well done and thanks for making this available to the community.
apoorv-2204
Can we use this in production?
cheerfulstoic
As far as I know it’s been working stably for people. It has a pretty thorough test suite. So overall, it should be fine to use in production.
The method of database notifications that
ecto_watchuses should scale quite a ways, but if you have a really large amount of activity or if you have big bursts, you should understand it’s performance characteristics (as with anything).I have one PR that I hope to be merging soon to protect people from database trigger/function names being too long. Before that is merged, I’d suggest checking out this issue and using the
labeloption if you experience a similar issue on startup.apoorv-2204
is it possible to have brief overview of it works as diagram if otp used?
cheerfulstoic
Not sure that I understand, but the structure that is used is pretty simple. If you add
EctoWatchinto your application, aSupervisoris created. For everyEctoWatchwatcher that you add, aGenServeris created which listens for messages from the database.When the
Supervisoris started, it runs these queries for each watcher:CREATE OR REPLACE FUNCTION ...DROP TRIGGER IF EXISTS ...CREATE TRIGGER ...The trigger calls the function which sends a notification to your application/the watcher
GenServer.And then each
GenServerdoes aPhoenix.PubSub.broadcastfor each message from the database so that you can get application updates (as described in theREADME)If that’s not clear I’m happy to answer other questions.
Bodhert
Great library! thanks for creating this!
I did find and issues (there was no clear way) trying to test. I did create an issue on GitHub to clarify how I managed to test it with the core logic, or if maybe I am missing another easy way to test it.
https://github.com/cheerfulstoic/ecto_watch/issues/43
cheerfulstoic
Thanks very much! I left a comment there and perhaps that’s the best place to continue the discussion
StandardMikeBenza
Do you have any advice for using this in conjunction with
Ecto.Adapters.SQL.Sandboxin tests? I’d like to build a test that triggers a SQL change and verify that a side-effect event happens. When trying to startEctoWatch,Ecto.Adapters.SQL.Sandboxcomplains. I haven’t dug too deep into it yet – I just wanted to see if you have any advice before I go in.cheerfulstoic
Yeah, that’s actually the thing that @Bodhert was suggesting in his issue that he linked to. Basically his approach is to disable the sandbox for tests which require verifying your
ecto_watchconfiguration/setup. He was suggesting that we could have a guide in the docs to discuss it.