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

AstonJ
Just starting to go up - here's the first three: By @lpil By @Crowdhailer By Evadne Wu (Why aren't you a member Evadne :p)
New
ElixirConf
ElixirConf: ElixirConf 2023 - Tim Gremore - Replacing React: How Liveview solved our performance problems Comments welcome! View the <sp...
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
axelson
We’re now on the day 2 talks! ElixirConf US 2018 – Understanding Elixir’s (Re)compilation – Renan Ranelli Elixir’s code...
New
axelson
ElixirConf US 2018 – Texas: Virtual DOM Library for Server-Side V-DOM. – Dan McGuire (@dgmcguire) Client-side applicatio...
New
axelson
ElixirConf 2017 - Managing Tables With Elixir and OTP - Robert Beene We’ve all waited for a table at a resta...
New
derpycoder
QUIC protocol support coming to BEAM. As of now, I am using Caddy in front of Phoenix server to experience HTTP/3 goodness.
New
CodeSync
Code Sync: Keynote: The Road To LiveView 1.0 by Chris McCord | ElixirConf EU 2023 Comments welcome! View the #code-sync and #elixirconf-...
New
axelson
ElixirConf US 2018 – Beyond Command and Response Chatbot – Fahad Almusharraf The talk discusses an attempt at building a...
New
axelson
by @jola Can you write a performant string processing scripts in Elixir? This talk attempts to answer that question while incrementally...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement