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
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library.
The progre...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Aloha gang,
There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here:
...
New
I’ve moved the strategies out of PowAssent and created a multi-provider framework for Elixir. This way the strategies can be used in any ...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hi everyone :waving_hand:
I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New
If you haven’t tried Hologram yet, what’s stopped you?
Here’s why I’m asking. Building a framework turns out to be two jobs, the framewo...
New
Popcorn, the library that runs Elixir code in the browser, is now stable :popcorn:
This is possible because it now builds on a very stab...
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
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #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.