wolf4earth

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:

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?

Most Liked

MrDoops

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_info callbacks 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

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.

Where Next?

Popular in Discussions Top

PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39247 209
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
WolfDan
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
AstonJ
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
Qqwy
I would like to spark a discussion about the static access operator: .. For whom does not know: it is used in Elixir to access fields of...
New
jsonify
So, is Heroku the only free option for hosting Phoenix/Elixir at this point? I’m not ready to commit to paying monthly and was wondering ...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43591 214
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement