I wrote this up after having written a tutorial on doing this in GenStage around a decade ago, and thought it was interesting to have the two of them side by side to consider. I linked the original in the document linked to here.
Overall, I'm wildly impressed at how this Elixir code held up, and it was a joy to revisit this.
Years ago I built something similar, a Pub/Sub notification system: https://github.com/huqedato/qnotix. It is still running (with small modifications), in production, at my ex-customer.
Such a pity the industry (customers) reacts with skepticism every time I propose solutions based in Elixir/Erlang. I always hear: "Elixir, what? We want Java/.Net/Python/php"
As someone who has been learning Elixir on and off for over a year, this looks really exciting on first skim through. Excited to give this a deep read this weekend!
Minor criticism, you can't claim this as a problem "Unfair distribution - Fast workers might grab all the work" and then turn around and claim it as a benefit in your own solution "Natural load balancing - Fast consumers get more work".
Iād love to see one for Elixir built around the Postgres pgmq and pg_crom extensions similar to what pgflow is doing: https://www.pgflow.dev/
The absolute facility with which you can do distributed applications in Elixir is the big thing that sold me in the first place. Nice to see this tutorial!
Just want to say thank you for the detailed write up. I am enjoying the article a lot!
I have not seen a single Elixir project that doesn't have a spaghetti mess made out of macros.
You can rant all you want about the disadvantages of OOP and other paradigms. But after your rant, do not come up with an even more absurd type system that gives you even more work to do without any upside.
Building a project out of constructs such as macros does not scale with project size or team size. The only aspect that scales is the resulting size of the unmanageable spaghetti. Tolerating having that as a widely used feature in your language and then praise it as being fantastic truly makes one wonder what are you comparing the Elixir experience with? Elixir is fantastic compared to... fighting 100 gorillas blindfolded.
There are good choices built into the language, like railroad oriented programming. But those will never undo the infinitely awful and inadequate insanity of having to deal with macros to survive.
And to be frank, even if there are use-cases where the language shines and can be excellent tool for the job, most of the time those are not your use-case, and most of the time your team is not familiar with the language enough to leverage its advantages or build something production-worthy.
And if you ever go through the pain of mastering Elixir, 99.99% of the time your next job will not use it. If you are at a startup celebrating the virtues of Elixir before having enough revenue, your next non-Elixir job is closer than you think because your company will run out of money. And if your plan is having a LLM help you write Elixir faster before you burn through your budget? Good luck debugging a labyrinth made out of AI generated macros, your on-call rotation will go great. Your stakeholders will be eager to learn more about how great Elixir is when they ask for an explanation of why nothing works, an estimate of when it will be fixed, why is the project late or how can they add more team members to make it go faster.
Incredibly well written. You clearly put a lot of thought and effort into this. Thank you.
Also FOR UPDATE SKIP LOCKED is interesting.
pure HN comedy that the article is about the disgust of running acme tools that cram all buzzwords just for the lulz, and most comments are pushing even worse tools with even more buzzwords ("still the torment Nexus, but in elixir!")
sigh. anyway. i had the same reaction to acme. but I'm lazier. i just ran ngix and the acme client in qemu and picked the certs out. i applaud the author for her tenacity.
FYI if anyone is looking for a production ready job runner in Elixir, I strongly recommend Oban. They have a paid pro version but the open source version is still absolutely fantastic.