| This was a fun read! It reminds me of a very similar post I put out in 2018
https://by.ben.church/Get-notified-of-user-signups-and-plan-... But I think Peter did a much better job going through the mechanics and providing a more modernized example. For those that are curious there are pitfalls (that can be worked around) 1. If your DB goes down you may loose messages 2. If you have multiple backends behind a load balancer you may trigger additional events 3. There is a limit to the payload size you can send through these triggers But for those that want to try this approach I do have a library here that does wraps everything Peter layed out:
https://github.com/bnchrch/postgrex_pubsub Also if you want something even better I recommend WalEx
https://github.com/cpursley/walex Which is based on WAL logs and doesnt have the same limitations. |