axelson

axelson

Scenic Core Team

37) ElixirConf US 2018 – Event Sourcing in Real World Applications: Challenges, Successes and Lessons Learned. – James Smith

ElixirConf US 2018 – Event Sourcing in Real World Applications: Challenges, Successes and Lessons Learned. – James Smith

Our client came to us wanting to build a real time auction application for supplying fuel to ships.

This was exciting! We were going to be auctioning upwards of 1000 metric tons of fuel using Elixir and Phoenix! What could go wrong?

From the beginning of the project there was a hard requirement for auditing. Anything that happened in the system needed to be recorded. This lead us to the idea of Event Sourcing.

What is Event Sourcing?
Event Sourcing is a way of ensuring all changes to an application’s state are stored as a sequence of events. Those events can be queried, logged and used to reconstruct past states.

In this talk I’ll cover the benefits and challenges with Event Sourcing and the solutions we came up with.

Benefits:

  • Predictability. Having a list of Events helped us to troubleshoot and reason about the state of our application.
  • *Testability. Using events to start the application in a desired state made Test setup easier.
  • *Resiliency. The ability to rebuild the state of any auction at any time made our application more resilient. An auction crashing during the bidding process was no longer as scary.

Challenges:

  • Complexity. Early on we struggled with deciding to implement the pattern ourselves or use a library. After trial and error we thought through our domain, and chose to implement it ourselves. This had both benefits and draw backs.
  • Ordering. The order in which things happened our system was important. Ordering events across multiple asynchronous processes was complex.
  • Race Conditions. Dealing with timers that trigger events without race conditions was difficult.
  • This project was both fun and challenging. I want share the knowledge that we gained from it, as well as our mistakes.

Audience: Intermediate, Advanced
Topics: event-sourcing, event-storming

All talks are available in the ElixirConf US 2018 Talks List or via the elixirconf2018 tag

Where Next?

Popular in Talks Top

axelson
by @takasehideki Can you imagine that your Elixir code will be executed as a hardware circuit on an FPGA? The FPGA (Field-Programmable...
New
axelson
ElixirConf US 2018 – Introducing Scenic - A Functional UI Framework – Boyd Multerer (@boydm) After years of...
New
New
axelson
Okay, after many days here is the final post on the Elixir Conf videos. Since there are so many lighting talks I felt that it is better t...
New
ShalokShalom
So, there is another Erlang VM on the way :hugs:
New
LostKobrakai
After having watched the talk I’m wondering if this would also be a good opportunity to gather examples / tips about how to prevent or mi...
New
AstonJ
File uploads are an essential part of many web applications, but often handling them can be tricky, which explains why they are one of th...
New
TwistingTwists
I am in middle of watching this. I have to stop every minute and think over what Chris just said. The amount of info he sends over that ...
New
axelson
ElixirConf US 2018 – Building Video Chat with Elixir & Phoenix – Anil Wadghule (@anildigital) In this t...
New
ElixirConf
ElixirConf: ElixirConf 2023 - German Velasco - Using DDD concepts to create better Phoenix Contexts Comments welcome! View the <span cla...
New

Other popular topics Top

chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement