Temat
Event Sourcing
Artykuły o podstawach i praktycznym zastosowaniu Event Sourcingu, modelowaniu zdarzeń, projekcjach, testowaniu oraz utrzymaniu systemów na produkcji.
Polecana kolejność czytania
Czytaj w tej kolejności, aby przejść od podstaw do praktycznych kompromisów i problemów produkcyjnych.

Introduction to Event Sourcing - Self Paced Kit
2022-03-16For 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 my journey with Event…
What's the difference between a command and an event?
2021-02-17What’s the difference between a command and an event? The answer seems apparent, but let’s see if it’s straightforward. The command represents the intention. It targets a…
How to get the current entity state from events?
2021-06-30Today 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, it’s handy to take a step back…
How to validate business logic
2023-01-15Fox Mulder got advice: “trust no one”. I’m claiming that each software developer should define their level of paranoia. The thing that we should never trust is the…
Guide to Projections and Read Models in Event-Driven Architecture
2023-01-20If 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 are facts; they represent…
Testing business logic in Event Sourcing, and beyond!
2022-10-07I’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 streaming. Event Sourcing logic is…
Simple patterns for events schema versioning
2021-12-08Events (schema) versioning is a boogeyman for people learning Event Sourcing. They’re a spooky tale told at the campfire. There’s a truth in it, as migrations are always…
When not to use Event Sourcing?
2021-06-23Event Sourcing is perceived as a complex pattern that’s challenging to learn. Typically it’s matched with the financial industry or big enterprise systems. If you’re…
Więcej artykułów

Start Small, Grow Big: how to pick the first feature for Event Sourcing
2026-08-31Let’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 table, and someone finally…
Fixing bugs in Event Sourcing is hard, for real?
2026-07-27Every 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 comes from us, because we…
Throw, Result, or neither?
2026-07-20There 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 an exception. They would put…
Yoda Principle for better integrations
2026-04-20Try 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 galaxy far, far away. He was…
Anti-patterns in event modelling - Passive-Aggressive Events
2026-04-13Have 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 aware, the meeting started 1…
Handling Events Coming in an Unknown Order
2025-11-03After the last article on Dealing with Race Conditions in Event-Driven Architecture with Read Models, I got such a question from Ben: You described the scenario where you…
Dealing with Race Conditions in Event-Driven Architecture with Read Models
2025-10-20My 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 you today. Everyone has a plan…
How to build MongoDB Event Store
2025-01-10I 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 event store in Emmett. And let…
Idempotent Command Handling
2024-11-15“Is your command handling idempotent?” Sounds like a douchebag question to ask. Actually, that’s not a question but a statement that we want to sound smart. Maybe a…
Using event metadata in event-driven projections
2024-08-25Some 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 Theory? Authors (James Q…
Writing and testing event-driven projections with Emmett, Pongo and PostgreSQL
2024-08-14In 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 Sourcing in Node.js on top of…
Combining the To-Do List and the Passage Of Time patterns for resilient business workflows
2024-06-07Managing processes is non-trivial. I have written about it in multiple posts and told you the horror story of the case that should have never happened. Business processes…
How to build an in-memory Message Bus in TypeScript
2024-04-12I’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 do an exercise designing a type…
Event modelling anti-patterns explained
2024-04-07Have 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 gave at Kafka Summit 202…
I'm no longer Marten maintainer
2024-03-29Folks, 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 when either you need to settle…
Testing Event Sourcing, Emmett edition
2024-03-23I’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 course, a “thank you for…
Join my Event Sourcing workshops at Techorama and DDD Europe and speed up your journey!
2024-03-17Event Sourcing is a pattern that is quickly gaining popularity. Many companies see the advantages it brings, e.g. business focus and keeping all information about the…
Should you always keep streams short in Event Sourcing?
2024-02-24In the last article and others I did my best explaining why keeping streams short is important in Event Sourcing. I also showed you how. That should take you far enough…
Implementing Closing the Books pattern
2024-02-17No one knows who invented Event Sourcing. I overheard that Hammurabi did. Why? Because he standardised the first set of rules of accounting. Event Sourcing works as…
Announcing Emmett! Take your event-driven applications back to the future!
2024-02-11Simple 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 I come up with it?”. That…
Production-Grade Event Sourcing Workshop - Modelling, DevOps, Process
2024-02-04Putting 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 something was missing and that…
How TypeScript can help in modelling business workflows
2024-01-28TypeScript is an intriguing language. Some say that its type system, by itself, is Turing Complete. Some take it to the extreme and even implement Flappy Bird in…
Stream ids, event types prefixes and other event data you might not want to slice off
2024-01-21You’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 craft or even art. Last week…
Should you record multiple events from business logic?
2024-01-14Asking people for feedback is an intriguing story. I like to get constructive criticism for my work, as that allows me to learn something new. When I prepare some new…
Hitchhiker's Guide To Moving From Relational Data To Events
2023-12-15Knock 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 about the end of the CRUD world…
Anti-patterns in event modelling - Clickbait event
2023-11-05Doctors Hate Her! Discover the Simple Trick to Lose Weight Overnight! This One Weird Trick Can Save You Hundreds on Your Energy Bills! The Secret Investment Banks Don’t…
Oops I did it again, or how to update past data in Event Sourcing
2023-09-22One 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 Sourcing are also its superpowers…
My journey from Aggregates to Functional Composition
2023-09-08I was recently asked what drove me to mostly use immutable data and methods rather than the Aggregate Pattern in my samples and videos. I decided that it might be worth…
Event transformations, a tool to keep our processes loosely coupled
2023-08-31One of the biggest pains in traditional software design is accidental complexity. We want to understand and reflect on the business process in the code, but our…
Prototyping, an underestimated design skill
2023-08-25Coding is an underestimated part of the design. When we think about the design, we immediately fall to whiteboard diagrams, sticky notes, or endless discussions. That’s…
Could you help me by filling a short survey about an online course?
2023-08-11I 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, self-paced kits, and OSS works…
Recap of Event Sourcing Live 2023
2023-06-15InfoQ 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 doing it, as you’re not…
The Holy Grail syndrome
2023-06-01Our industry is harmed by the disease of “There has to be something more!” also called “The Holy Grail syndrome”. Instead of trying to understand building blocks as they…
Anti-patterns in event modelling - I'll just add one more field
2023-05-28Programming origins are in mathematics. Scientists like John Von Neumann and Alan Turing built the foundations for today’s computers. That may be a reason why we tend to…
Is the audit log a proper architecture driver for Event Sourcing?
2023-05-20Usually, one of the main drivers for Event Sourcing is the audit log capability. Indeed event stores are append-only logs, theoretically, we’re getting that for free. Yet…
General strategy for migrating relational data to document-based
2023-05-07I was recently asked how to migrate a project using relational data to a document-based approach (e.g. from .NET ORM Entity Framework into Marten). As always, it’s easy…
How to test event-driven projections
2023-04-29Projections in an event-driven world are a way to interpret registered events. We can take a sequence of events and build from them read models in a predictable way. They…
Publishing read model changes from Marten
2023-04-23Integrations have different names, shades and colours, but only one adjective: challenging. Trying to glue systems together requires matching two visions into one. That’s…
Event stores are key-value databases, and why that matters
2023-04-07Event stores are the foundational building block of Event Sourcing. They’re also one of the biggest sources of confusion. They are databases turned upside down, append…
Ensuring uniqueness in Marten event store
2023-03-24Unique constraint validation is one of those things that looks simple but is not always easy. I explained already that, in Event Sourcing, it may be challenging. In…
Projecting Marten events to Elasticsearch
2023-03-18I 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 provide various ways of…
How to handle multiple commands in the same transaction
2023-03-12Let’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 the project that won’t have…
Set up OpenTelemetry with Event Sourcing and Marten
2023-02-19If 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 given. Use them, and let’s…
Event-driven projections in Marten explained
2023-02-12Projections are a neverending story. One does not simply write a single guide. One needs to write more examples of more advanced cases. That’s precisely what one here…
Let's build event store in one hour!
2023-01-08Last year, I completed two items from my speaker bucket list NDC Oslo and Domain-Driven Design Europe. I’m proud and happy, as those conferences were a huge inspirations…
Explicit events serialisation in Event Sourcing
2022-12-23Events serialisation is an intriguing topic. On the one hand, it’s part of the campfire spooky tales, so (in)famous events versioning. On the other, we’re just taking…
The magic is that there is no magic. Or how to understand design patterns.
2022-12-18The magic is that there is no magic. Many patterns perceived as complicated appear to be simple or even simplistic under the cover. Take, for example, Event Sourcing. In…
Share your story on Event Sourcing Live 2023
2022-12-06Event Sourcing is a concept that helps to build the bridge between business and technical implementation. It’s a storage pattern that takes the business facts and uses…
Mapping event type by convention
2022-11-27Events are an essential block of Event-Driven Architecture. They represent business facts that happened in our system. We can use them to integrate business workflow…
Never Lose Data Again - Event Sourcing to the Rescue!
2022-11-06Relational databases are not losing data. They’re robust, consistent and secure! Are they? Too often, we mix technical and logical concepts. Business transactions are not…
Event Versioning with Marten
2022-09-07War never changes; migrations are always complex. It’s always a mind gymnastics and searching for risks and what may go wrong. Sometimes we try to cheat, ignore the…
Slim your aggregates with Event Sourcing!
2022-08-31In 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 set of functionality in a…
Straightforward Event Sourcing with TypeScript and NodeJS
2022-08-03In the last two articles, I explained how to organise your business logic effectively, showing how proper typing and composition can help to achieve that. That came with…
Union types in C#
2022-07-27In the article “How to effectively compose your business logic”, I explained how explicit types definition can help in making our codebase closer to the business domain…
How to effectively compose your business logic
2022-07-20Let’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 cart after opening it. When…
Event-driven distributed processes by example
2022-07-13Some time ago, I wrote the general rules on processing the event-driven services. check my article Saga and Process Manager - distributed processes in practice. It…
Should you throw an exception when rebuilding the state from events?
2022-06-08Event Sourcing is not a difficult pattern to understand. Event stores are not conceptually complicated databases (although implementation may be quite complex). We have…
Persistent vs catch-up, EventStoreDB subscriptions in action
2022-05-04Events can be a great facilitator and glue for business workflows. Subscriptions are an essential block of the event-driven system. They notify us about each of the…
How to build a simple event pipeline
2022-04-27Today 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 later on. If you read my…
Are Temporal Tables an alternative to Event Sourcing?
2022-04-20I’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 temporary tables. They are…
How to ensure uniqueness in Event Sourcing
2022-03-09“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 someone starting the journey with…
A simple trick for idempotency handling in the Elastic Search read model
2022-01-26Idempotency 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 in programming (or, as some…
Using strongly-typed identifiers with Marten
2022-01-19Let’s say that you have the following class definition: Now you can create instance using: So far, so good. What if we accidentally mixed the order of the parameters to…
Integrating Marten with other systems
2021-12-29In Event Sourcing, events are the source of truth. We save them in the event store to have a permanent history of facts about business operations. Storing events and…
How to do snapshots in Marten?
2021-12-22Getting the state from events is a basic but controversial topic in Event Sourcing. I wrote on it longer in other article. To recap, Classically, in Event Sourcing, we…
Keep your streams short! Temporal modeling for fast reads and optimal data retention
2021-12-09Modeling is hard. We need to take so many things into account. This article will explain the basics of temporal modeling, a foundation for keeping your stream short…
Let's talk about positions in event stores
2021-10-06Discussions about positions can be awkward, to say the least… It is also the case with positions in Event Sourcing. Each event store implementation has its own…
How to build event-driven projections with Entity Framework
2021-09-29Let’s assume that you’re building an Event-Driven system. You may be using Event Sourcing or microservices integrated with message bus or monolith with modules triggering…
Anti-patterns in event modelling - State Obsession
2021-09-15Some time ago, I tackled the first event modelling anti-pattern: “Property Sourcing”. Today I’d like to tackle the next one: “State Obsession”. I have already written…
Anti-patterns in event modelling - Property Sourcing
2021-08-18The 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 programming, I was looking…
Snapshotting Strategies
2021-07-16Snapshotting-Strategies-Feat Looking at resources from the Internet, you may conclude that snapshots are an essential part of the Event Sourcing system. It may be…
How to scale projections in the event-driven systems?
2021-05-26People 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 instance. Does it always make…
Snapshots in Event Sourcing
2021-05-20ES-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 event appended to the event…
How using events helps in a teams' autonomy
2021-04-28Autonomy 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. I’ve written in the past on…
Events should be as small as possible, right?
2021-04-14TV 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 amount of information should it…
How to create projections of events for nested object structures?
2021-04-07Did 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 few times you got backslash…
What if I told you that Relational Databases are in fact Event Stores?
2021-02-03Are 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 have relational databases? Why…
What texting your Ex has to do with Event-Driven Design?
2021-01-27We sometimes feel melancholic, blue and a bit messy. When we enhance those feelings with “gummy berry juice” then various dubious ideas come to our minds. We grab the…
How to (not) do the events versioning?
2020-12-23Developers that are not running a system in production might call themselves lucky. They can live in their perfect world. It is a world where there are no problems…
Why a bank account is not the best example of Event Sourcing?
2020-12-09While explaining the Event Sourcing, bank account balance calculation is a common starting point. I claim that even though it sounds right, then it’s not the best example…
Revolution now!
2020-12-02Did 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 mean leaving the project that…
Relacja z Domain Driven Design Europe 2020 – Event Sourcing
2020-02-16Ten 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 cierpliwość i czytaj dalej…