Event Sourcing do's and don'ts

preview_player
Показать описание
When people are getting into Event Sourcing, there are a few common questions that I often get or issues see people run into. CRUD Sourcing, Pre-mature optimization using Snapshots, and exposing your event streams for integration.

🔗 EventStoreDB

💥 Join this channel to get access to source code & demos!

🔥 Don't have the JOIN button? Support me on Patreon!

0:00 Intro
0:32 CRUD Sourcing
3:33 Snapshots
7:22 State vs Communication

#eventsourcing #cqrs #softwarearchitecture
Рекомендации по теме
Комментарии
Автор

You should really create a course. Like maybe a few hours of theory, then a project involving several micro services with event sourcing. I’d make my company pay for a seat for me anyway…

AlexandreCassagne
Автор

Derek, you nailed it - these are the issues that we see each time a new team picks up Event Sourcing. Great summary!

leopoldodonnell
Автор

CodeOpinion is my favourite Event Sourcing series 😍

cristianpallares
Автор

I love this channel, thanks for being here!

staan.b
Автор

I loved the name for integrated events. We use domain events for both porpuses, even w/o event sourcing, and we actually had meetings where we were trying to find a good name for them. Service events were one of the candidates. Integration events are great too, I'll remember this.

RM-bgcd
Автор

Thank you for the clear & simple explanation!! 👍👍

frankglynnegrobbelaar
Автор

I have a question about implementing this IF we need to do some external transactions, like bank widthdraw, sending email, etc. these are event that should be execute once, so I wonder how people doing this?, maybe is not part of event? or is checking flag or something to verify is the first time?

jaiderariza
Автор

Great videos! I have a questions: somebody knows how to approach (for example) GetAllCustomers? Do I need to iterate all the streams in my EventStore, and check if they are a Customer? This sounds super innefficient for me... is there another way? Thanks!

axelbrinck_
Автор

Hey Derek,

I have a use case at my work where I think event sourcing makes a lot of sense - Purchase Orders. Basically people can create purchase orders and we want a list of all the transactions that have been applied against that Purchase Order.
The problem I have is it feels like there are 2 parts, the first is when they are just creating the Purchase Order and all it's lines (crud), then the next is when they are processing different actions on the PO such as receipting/invoicing (Event Sourcing).

Our application is a 'generic' solution for customers, and if we made every field require an action while creating it our customers would be up in arms (There are ~10-20 fields per PO line and ~20-30 fields on the PO itself). Once the PO is finalized this is no longer a problem. Is it possible to make a system that is crud in natures until a certain point then cross over into using event sourcing later (E.G once the PO is finalized)?

I don't really like the idea of that, so I'd lean towards doing the 'PurchaseOrderUpdated' style events but I also don't like that idea for the reasons you've said. Potentially we have a design issue, but I'm not really sure about how we could change it.
Just wondering if maybe this use cause isn't great for Event Sourcing or if you have any ideas to manage/design this.

lolop
Автор

Hi Derek, if I build a social media application, and use event store for the post in the social app. If each comment to the post will be a events to post, in the case there might be hundreds and thousands of the comments. Should I considering using the snapshot? And when people reply on a comment, I will need to check if the comment ID is valid but containing all the comment IDs in the final state of the aggrigate for the post event stream. By doing this, the snapshot will be way too big if there are just too many reply on one post. How to resolve this?

tony-ma
Автор

In your CRUD events example, how would you represent the remaining CRUD fields: name and description. Would these be okay being "ProductDetailsUpdated" for example? As opposed to needing to come up with a business scenario where those would be changed.

havokgames
Автор

While the last point makes sense in some cases, from my experience I've found that using the same domain events for consumption by other services can and indeed often is a more pragmatic approach. It's a little bit like with snapshots example- i.e. integration events are useful, but use them when you actually need them. To be clear- I mean consuming those events from different services that contribute to the same broader system. Integration events should definitely be used for communication between different systems.

ernest
Автор

Incredible video. Thank you so much for sharing this.

ZachBugay
Автор

Hello.So an event store db, as far as i understood is not only a database but message broker, because i can subscribe on it, right?

thedacian
Автор

Do you have a Stream for each Product? Or is it the ProductsStream and all different Product Aggregates are stored there?

RaveKev
Автор

Thanks for your awesome tutorial. I'm new to Event Sourcing. Is it a best practice to use Event Sourcing for Post's likes/unlikes in a social media website? I mean considering performance, cocurrency and Data integrity.

tmati
Автор

Another great video. Is "crud-sourcing" that bad? My point of view it that it can be fine if you are building up your "reference data" with it. Everything that is the "process" of the application definitely need to have more business specific events. Concrete example, if I have a system that a user interacts with and the what happens during the interaction is based on a set of rules. When you create the rules that are used in the interaction I think "crud-sourcing" is a valid option, but the actual user interactions should be using proper event sourcing.

TomasJansson
Автор

How do you handle GDPR requests when even sourcing ?

I mean I wouldn't event-source every aggregate so maybe some identity is not what one should event-source and that's a non-issue

pierre-antoineguillaume
Автор

Do you have another video that shows how we could perform changes on records in an event store? For an example, lets say Quantity (in your video) changes from an integer to a float ( for some reason. )

How would you handle that exactly?

ZachBugay
Автор

I like the video, but I have a question about snapshots. In the video you say most of the time there's no reason to make them, but i'm not sure if there's any reason to not make them. For me waiting with optimization until your api gets too slow is a bad practice. Beside that, if app is big enough there will be problem with performance even with otherwise small streams, eg. displaying amount of every product on a big list for ux reasons. If you get enough users doing that at once across different instances, it might be better trade to use more storage for snapshots rather than compute power to calculate the states, since snapshot is in a way a cache. And even beside that, by making snapshots you give up space to get compute power back, in a system with event sourcing you clearly don't worry about storage space so i don't see a reason to not use snapshots.

PiesekLeszek