Event Sourcing
Event Sourcing zapisuje każdy fakt biznesowy jako zdarzenie i z nich odtwarza bieżący stan. Dostajesz pełną historię danych, ale też nowe pytania: co zapisywać, gdzie to trzymać, co zrobić, gdy zdarzenia trzeba zmienić, i jak to wszystko testować. Artykuły poniżej na nie odpowiadają, od najnowszych. Poza relacją z DDD Europe 2020 wszystkie są po angielsku.
Jeśli dopiero zaczynasz, przewodnik Podstawy Event Sourcingu układa podstawy w sensownej kolejności.
90 artykułów
![Start Small, Grow Big: how to pick the first feature for Event Sourcing]()
Start Small, Grow Big: how to pick the first feature for Event Sourcing
Let’s say we did the hard part. We read up on Event Sourcing, even here on my blog; we did a modelling workshop, we got the nods around the…
![Fixing bugs in Event Sourcing is hard, for real?]()
Fixing bugs in Event Sourcing is hard, for real?
Every system ends up with bad data. Some of it comes from integrations, some from users doing things nobody predicted, and a good part of it…
![Throw, Result, or neither?]()
Throw, Result, or neither?
There is one question I keep getting about my event-sourced code: why don’t I use ? It usually comes after someone sees a decision throwing…
![Yoda Principle for better integrations]()
Yoda Principle for better integrations
Try not. Do. Or do not. There is no try! I’m calling this the Yoda Principle. Master Yoda said that to Luke Skywalker a long time ago in a…
![Anti-patterns in event modelling - Passive-Aggressive Events]()
Anti-patterns in event modelling - Passive-Aggressive Events
Have you ever heard phrases like. Just an update, the milk ran out. Someone finished it and put the empty carton back. Or So everyone is…
![Handling Events Coming in an Unknown Order]()
Handling Events Coming in an Unknown Order
After the last article on Dealing with Race Conditions in Event-Driven Architecture with Read Models, I got such a question from Ben: You…
![Dealing with Race Conditions in Event-Driven Architecture with Read Models]()
Dealing with Race Conditions in Event-Driven Architecture with Read Models
My events came out of order! What should I do?! Are you familiar with the term “phantom record” and its benefits? No? Let me explain it to…
![How to build MongoDB Event Store]()
How to build MongoDB Event Store
I have always said that MongoDB is not the best choice for event storage, and guess what? I just released the stable version of the MongoDB…
![Idempotent Command Handling]()
Idempotent Command Handling
“Is your command handling idempotent?” Sounds like a douchebag question to ask. Actually, that’s not a question but a statement that we want…
![Using event metadata in event-driven projections]()
Using event metadata in event-driven projections
Some time ago, I wrote about the dangers that come from the I’ll just add one more field” attitude. Have you heard about the Broken Window…
![Writing and testing event-driven projections with Emmett, Pongo and PostgreSQL]()
Writing and testing event-driven projections with Emmett, Pongo and PostgreSQL
In the previous article, I told what happened when Emmett and Pongo walked into a bar. In other words, I announced that you can now do Event…
![Combining the To-Do List and the Passage Of Time patterns for resilient business workflows]()
Combining the To-Do List and the Passage Of Time patterns for resilient business workflows
Managing processes is non-trivial. I have written about it in multiple posts and told you the horror story of the case that should have…
![How to build an in-memory Message Bus in TypeScript]()
How to build an in-memory Message Bus in TypeScript
I’m writing this article on Friday, and it’s about time to have some fun. As this is a programming blog, let’s have some fun coding. Let’s…
![Event modelling anti-patterns explained]()
Event modelling anti-patterns explained
Have you heard about Passive Aggressive Events or CRUD sourcing? Or maybe about the Clickbait event? If you don’t, you better check the talk…
![I'm no longer Marten maintainer]()
I'm no longer Marten maintainer
Folks, I’d like to inform you that I’m no longer a Marten maintainer. As you know, sometimes in the project’s lifetime, there’s a moment…
![Testing Event Sourcing, Emmett edition]()
Testing Event Sourcing, Emmett edition
I’ve been going pretty down the rabbit hole in the last few years. What am I searching for? A way to deliver better software. And that’s, of…
![Join my Event Sourcing workshops at Techorama and DDD Europe and speed up your journey!]()
Join my Event Sourcing workshops at Techorama and DDD Europe and speed up your journey!
Event Sourcing is a pattern that is quickly gaining popularity. Many companies see the advantages it brings, e.g. business focus and keeping…
![Should you always keep streams short in Event Sourcing?]()
Should you always keep streams short in Event Sourcing?
In the last article and others I did my best explaining why keeping streams short is important in Event Sourcing. I also showed you how…
![Implementing Closing the Books pattern]()
Implementing Closing the Books pattern
No one knows who invented Event Sourcing. I overheard that Hammurabi did. Why? Because he standardised the first set of rules of accounting…
![Announcing Emmett! Take your event-driven applications back to the future!]()
Announcing Emmett! Take your event-driven applications back to the future!
Simple is not easy. Each person has its definition of it. For me, it means that when I look at the solution, I think: “So simple. Why didn’t…
![Production-Grade Event Sourcing Workshop - Modelling, DevOps, Process]()
Production-Grade Event Sourcing Workshop - Modelling, DevOps, Process
Putting the career bets is not easy; I made boring and pragmatic choices for most of my career. They took me far. Yet, I always felt that…
![How TypeScript can help in modelling business workflows]()
How TypeScript can help in modelling business workflows
TypeScript is an intriguing language. Some say that its type system, by itself, is Turing Complete. Some take it to the extreme and even…
![Stream ids, event types prefixes and other event data you might not want to slice off]()
Stream ids, event types prefixes and other event data you might not want to slice off
You’re reading much more code than you’re writing. Readability is a highly subjective term. That’s probably why some call what we’re doing…
![Should you record multiple events from business logic?]()
Should you record multiple events from business logic?
Asking people for feedback is an intriguing story. I like to get constructive criticism for my work, as that allows me to learn something…
![Hitchhiker's Guide To Moving From Relational Data To Events]()
Hitchhiker's Guide To Moving From Relational Data To Events
Knock knock? Who’s there? It’s me, Oskar, the end is near, did you know that? Ah, you know it but don’t know how to proceed? Let’s talk…
![Anti-patterns in event modelling - Clickbait event]()
Anti-patterns in event modelling - Clickbait event
Doctors Hate Her! Discover the Simple Trick to Lose Weight Overnight! This One Weird Trick Can Save You Hundreds on Your Energy Bills! The…
![Oops I did it again, or how to update past data in Event Sourcing]()
Oops I did it again, or how to update past data in Event Sourcing
One team win is a loss for the other. For some people, money loss is a gain for others. In the same way, the challenging parts of Event…
![My journey from Aggregates to Functional Composition]()
My journey from Aggregates to Functional Composition
I was recently asked what drove me to mostly use immutable data and methods rather than the Aggregate Pattern in my samples and videos. I…
![Event transformations, a tool to keep our processes loosely coupled]()
Event transformations, a tool to keep our processes loosely coupled
One of the biggest pains in traditional software design is accidental complexity. We want to understand and reflect on the business process…
![Prototyping, an underestimated design skill]()
Prototyping, an underestimated design skill
Coding is an underestimated part of the design. When we think about the design, we immediately fall to whiteboard diagrams, sticky notes, or…
![Could you help me by filling a short survey about an online course?]()
Could you help me by filling a short survey about an online course?
I realised that I could do more to help you and other folks. I’ve been sharing online content for free in the last few years on this blog…
![Recap of Event Sourcing Live 2023]()
Recap of Event Sourcing Live 2023
InfoQ claims that Event Sourcing is in the late majority adoption phase. That means that if you haven’t started to use it, you better start…
![The Holy Grail syndrome]()
The Holy Grail syndrome
Our industry is harmed by the disease of “There has to be something more!” also called “The Holy Grail syndrome”. Instead of trying to…
![Anti-patterns in event modelling - I'll just add one more field]()
Anti-patterns in event modelling - I'll just add one more field
Programming origins are in mathematics. Scientists like John Von Neumann and Alan Turing built the foundations for today’s computers. That…
![Is the audit log a proper architecture driver for Event Sourcing?]()
Is the audit log a proper architecture driver for Event Sourcing?
Usually, one of the main drivers for Event Sourcing is the audit log capability. Indeed event stores are append-only logs, theoretically, we…
![General strategy for migrating relational data to document-based]()
General strategy for migrating relational data to document-based
I was recently asked how to migrate a project using relational data to a document-based approach (e.g. from .NET ORM Entity Framework into…
![How to test event-driven projections]()
How to test event-driven projections
Projections in an event-driven world are a way to interpret registered events. We can take a sequence of events and build from them read…
![Publishing read model changes from Marten]()
Publishing read model changes from Marten
Integrations have different names, shades and colours, but only one adjective: challenging. Trying to glue systems together requires…
![Event stores are key-value databases, and why that matters]()
Event stores are key-value databases, and why that matters
Event stores are the foundational building block of Event Sourcing. They’re also one of the biggest sources of confusion. They are databases…
![Ensuring uniqueness in Marten event store]()
Ensuring uniqueness in Marten event store
Unique constraint validation is one of those things that looks simple but is not always easy. I explained already that, in Event Sourcing…
![Projecting Marten events to Elasticsearch]()
Projecting Marten events to Elasticsearch
I told you already that Projections are an Event Sourcing killer feature, and today I’d like to repeat that. In Marten, we embraced that and…
![How to handle multiple commands in the same transaction]()
How to handle multiple commands in the same transaction
Let’s say that we’re starting a new project. It’s a small tool for internal needs, maybe even some sort of shadow IT project. It may also be…
![Set up OpenTelemetry with Event Sourcing and Marten]()
Set up OpenTelemetry with Event Sourcing and Marten
If I had to select the Distributed Systems Song, I’d choose Land of Confusion. This is the world we live in. And these are the hands we’re…
![Event-driven projections in Marten explained]()
Event-driven projections in Marten explained
Projections are a neverending story. One does not simply write a single guide. One needs to write more examples of more advanced cases. That…
![Guide to Projections and Read Models in Event-Driven Architecture]()
Guide to Projections and Read Models in Event-Driven Architecture
If I had to choose the killer feature of Event Sourcing, I’d select projections. Why? I’ll explain that in detail in this article. Events…
![How to validate business logic]()
How to validate business logic
Fox Mulder got advice: “trust no one”. I’m claiming that each software developer should define their level of paranoia. The thing that we…
![Let's build event store in one hour!]()
Let's build event store in one hour!
Last year, I completed two items from my speaker bucket list NDC Oslo and Domain-Driven Design Europe. I’m proud and happy, as those…
![Explicit events serialisation in Event Sourcing]()
Explicit events serialisation in Event Sourcing
Events serialisation is an intriguing topic. On the one hand, it’s part of the campfire spooky tales, so (in)famous events versioning. On…
![The magic is that there is no magic. Or how to understand design patterns.]()
The magic is that there is no magic. Or how to understand design patterns.
The magic is that there is no magic. Many patterns perceived as complicated appear to be simple or even simplistic under the cover. Take…
![Share your story on Event Sourcing Live 2023]()
Share your story on Event Sourcing Live 2023
Event Sourcing is a concept that helps to build the bridge between business and technical implementation. It’s a storage pattern that takes…
![Mapping event type by convention]()
Mapping event type by convention
Events are an essential block of Event-Driven Architecture. They represent business facts that happened in our system. We can use them to…
![Never Lose Data Again - Event Sourcing to the Rescue!]()
Never Lose Data Again - Event Sourcing to the Rescue!
Relational databases are not losing data. They’re robust, consistent and secure! Are they? Too often, we mix technical and logical concepts…
![Testing business logic in Event Sourcing, and beyond!]()
Testing business logic in Event Sourcing, and beyond!
I’ve heard a few times that Event Sourcing is hard to test. I’m not sure where this myth comes from; maybe from mixing it with event…
![Event Versioning with Marten]()
Event Versioning with Marten
War never changes; migrations are always complex. It’s always a mind gymnastics and searching for risks and what may go wrong. Sometimes we…
![Slim your aggregates with Event Sourcing!]()
Slim your aggregates with Event Sourcing!
In the traditional approach, what we get is what we store. Our write model is too often used directly as our read model, because the typical…
![Straightforward Event Sourcing with TypeScript and NodeJS]()
Straightforward Event Sourcing with TypeScript and NodeJS
In the last two articles, I explained how to organise your business logic effectively, showing how proper typing and composition can help to…
![Union types in C#]()
Union types in C#
In the article “How to effectively compose your business logic”, I explained how explicit types definition can help in making our codebase…
![How to effectively compose your business logic]()
How to effectively compose your business logic
Let’s say that we’d like to implement Shopping Cart. We have the following requirements: The customer may only add a product to the shopping…
![Event-driven distributed processes by example]()
Event-driven distributed processes by example
Some time ago, I wrote the general rules on processing the event-driven services. check my article Saga and Process Manager - distributed…
![Should you throw an exception when rebuilding the state from events?]()
Should you throw an exception when rebuilding the state from events?
Event Sourcing is not a difficult pattern to understand. Event stores are not conceptually complicated databases (although implementation…
![Persistent vs catch-up, EventStoreDB subscriptions in action]()
Persistent vs catch-up, EventStoreDB subscriptions in action
Events can be a great facilitator and glue for business workflows. Subscriptions are an essential block of the event-driven system. They…
![How to build a simple event pipeline]()
How to build a simple event pipeline
Today we will deal with event consumption. I’ll also explain how I wrote the new version of the MediatR library. Curious? We’ll get to that…
![Are Temporal Tables an alternative to Event Sourcing?]()
Are Temporal Tables an alternative to Event Sourcing?
I’ve been asked recently at least a few times about Temporal Tables and how they relate to Event Sourcing. Beware, and don’t confuse it with…
![Introduction to Event Sourcing - Self Paced Kit]()
Introduction to Event Sourcing - Self Paced Kit
For many developers, Event Sourcing is like a Nessie, most of them have heard of it, but not many have seen it. I was one of them. I started…
![How to ensure uniqueness in Event Sourcing]()
How to ensure uniqueness in Event Sourcing
“How do I ensure uniqueness? For example, a unique username or an invoice number.” That’s usually one of the first questions I hear from…
![A simple trick for idempotency handling in the Elastic Search read model]()
A simple trick for idempotency handling in the Elastic Search read model
Idempotency is a word worth watching out for. It’s easy to miss a few letters and bang, and we have a problem. It is also a general problem…
![Using strongly-typed identifiers with Marten]()
Using strongly-typed identifiers with Marten
Let’s say that you have the following class definition: Now you can create instance using: So far, so good. What if we accidentally mixed…
![Integrating Marten with other systems]()
Integrating Marten with other systems
In Event Sourcing, events are the source of truth. We save them in the event store to have a permanent history of facts about business…
![How to do snapshots in Marten?]()
How to do snapshots in Marten?
Getting the state from events is a basic but controversial topic in Event Sourcing. I wrote on it longer in other article. To recap…
![Keep your streams short! Temporal modeling for fast reads and optimal data retention]()
Keep your streams short! Temporal modeling for fast reads and optimal data retention
Modeling is hard. We need to take so many things into account. This article will explain the basics of temporal modeling, a foundation for…
![Simple patterns for events schema versioning]()
Simple patterns for events schema versioning
Events (schema) versioning is a boogeyman for people learning Event Sourcing. They’re a spooky tale told at the campfire. There’s a truth in…
![Let's talk about positions in event stores]()
Let's talk about positions in event stores
Discussions about positions can be awkward, to say the least… It is also the case with positions in Event Sourcing. Each event store…
![How to build event-driven projections with Entity Framework]()
How to build event-driven projections with Entity Framework
Let’s assume that you’re building an Event-Driven system. You may be using Event Sourcing or microservices integrated with message bus or…
![Anti-patterns in event modelling - State Obsession]()
Anti-patterns in event modelling - State Obsession
Some time ago, I tackled the first event modelling anti-pattern: “Property Sourcing”. Today I’d like to tackle the next one: “State…
![Anti-patterns in event modelling - Property Sourcing]()
Anti-patterns in event modelling - Property Sourcing
The first time I got down to work at Event Sourcing, I was very energized. Book knowledge almost fell out of me. However, when I sat down to…
![Snapshotting Strategies]()
Snapshotting Strategies
Snapshotting-Strategies-Feat Looking at resources from the Internet, you may conclude that snapshots are an essential part of the Event…
![How to get the current entity state from events?]()
How to get the current entity state from events?
Today I’d like to go back a bit to the basics of Event Sourcing. I recently realised that I often cover more advanced topics. So sometimes…
![When not to use Event Sourcing?]()
When not to use Event Sourcing?
Event Sourcing is perceived as a complex pattern that’s challenging to learn. Typically it’s matched with the financial industry or big…
![How to scale projections in the event-driven systems?]()
How to scale projections in the event-driven systems?
People want to scale up everything. In the past, the recipe for everything was to buy a larger server. Today, the answer is to add another…
![Snapshots in Event Sourcing]()
Snapshots in Event Sourcing
ES-Snapshots-1 One of the great benefits of Event Sourcing is that you don’t lose any business data. Each business operation ends with a new…
![How using events helps in a teams' autonomy]()
How using events helps in a teams' autonomy
Autonomy is the Holy Grail for the management of multiple teams. At least that’s how it’s perceived; it’s not easy to get the right balance…
![Events should be as small as possible, right?]()
Events should be as small as possible, right?
TV size? The bigger, the better. Debt amount? Opposite. It’s hard to find the right size that suits all. How big should the event be? What…
![How to create projections of events for nested object structures?]()
How to create projections of events for nested object structures?
Did you ever feel so encouraged so much that you immediately thought, “This is great, let’s do it!“. I’m sure you did. I’m also sure that…
![What's the difference between a command and an event?]()
What's the difference between a command and an event?
What’s the difference between a command and an event? The answer seems apparent, but let’s see if it’s straightforward. The command…
![What if I told you that Relational Databases are in fact Event Stores?]()
What if I told you that Relational Databases are in fact Event Stores?
Are you one of those people saying that Event Sourcing is detached from reality? Do you think that you don’t need such extravagance, as you…
![What texting your Ex has to do with Event-Driven Design?]()
What texting your Ex has to do with Event-Driven Design?
We sometimes feel melancholic, blue and a bit messy. When we enhance those feelings with “gummy berry juice” then various dubious ideas come…
![How to (not) do the events versioning?]()
How to (not) do the events versioning?
Developers that are not running a system in production might call themselves lucky. They can live in their perfect world. It is a world…
![Why a bank account is not the best example of Event Sourcing?]()
Why a bank account is not the best example of Event Sourcing?
While explaining the Event Sourcing, bank account balance calculation is a common starting point. I claim that even though it sounds right…
![Revolution now!]()
Revolution now!
Did you ever get an offer that someone will pay you for what you are currently doing as a hobby? What would be your decision if that would…
![Relacja z Domain Driven Design Europe 2020 – Event Sourcing]()
Relacja z Domain Driven Design Europe 2020 – Event Sourcing
Ten wpis będzie z tych dłuższych. Zrób sobie więc kawkę, wstąp do toalety, zrób kanapki na drogę, usiądź wygodnie na kanapie, uzbrój się w…

























































































