wolf4earth
What are you building your event-driven elixir systems on?
There are a number of ways to go about building an event-driven system in Elixir and which exactly you’re using depends on the needs of the application you’re building. This thread is meant to get a “lay of the land” for which tools the community likes to reach for.
To get us started here are some options I’ve seen mentioned in the wild:
- simple & self-built on-top of
Registry: Registry — Elixir v1.21.0-dev event_bus: GitHub - otobus/event_bus: 🏄 Traceable, extendable and minimalist **event bus** implementation for Elixir with built-in **event store** and **event watcher** based on ETS. · GitHubgen_stage: GitHub - elixir-lang/gen_stage: Producer and consumer actors with back-pressure for Elixir · GitHubphoenix_pubsub: GitHub - phoenixframework/phoenix_pubsub: Distributed PubSub and Presence platform for the Phoenix Framework · GitHubbroadway(+ external producer, e.g. Postgres, RabbitMQ etc.): GitHub - elixir-broadway/broadway: Concurrent and multi-stage data ingestion and data processing with Elixir · GitHub
What is your weapon of choice and why? Are you beginning with something simple and replace it with something else when the scale demands it? How do you structure your application when building a system like this and why?
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.
My initial shotgu...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
Other Trending Topics
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
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses:
I had hope...
New
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security











Most Liked
MrDoops
“It depends.” When it comes to messaging in Elixir there’s so many ways to approach it so there’s a suite of options.
Registry/PubSub are good for transient consumers with weaker guarantees. A liveview or channel can subscribe and the pubsub semantics deliver the message but if that Liveview session gets killed / disconnected: not a big deal. So a good tool for natural OTP process <> process delivery - just
handle_infocallbacks and a simple interface for topics.Genstage/Broadway are good for high throughput data pipelines and in a classic CQRS model are usually more seen in either command handling or projection/read-model construction.
I would also look at Eventstore and some of the Commanded tooling on top. In most workflows where pubsub is used you still need a persistent model and eventstore gives you a way to persist each event and deliver to n subscribers. The persistent stream interface has more going on than Phoenix PubSub, but it lets you revive a state machine by reading past events and rebuilding state.
After you have a persistent model of some kind, you might want to push that event to a messaging system or queue like RabbitMQ/SQS/Kakfa/etc either for integration to another system or to buffer some expensive data pipeline operation. Broadway in particular builds on Genstage to provide a high level tool to control for load and throughput such as to accumulate a set of “things to insert_all” into a database and prevent overload against potential bottleneck or protected resource like your reporting database.
Finally you might have those integration events that go out to external systems - this is where something like webhooks, Kafka, RabbitMQ streams, or some kind of high throughput messaging system with pubsub semantics, good subscriber guarantees and widespread client library support is good.
So all of the above when it depends.
katafrakt
If I were to build the whole app around events and reacting to them (which is a great way to build an app!), I would probably use Commanded on top of PostgreSQL (personal preference, I don’t like Event Store).
For just having an event bus to do some things reactively (and async) – event_bus package you mentioned looks great. Although I don’t have real experience with it.
For just organizing the codebase, you can just as well use a synchronous/inline event dispatcher, as described here or (shameless plug) here.