CQRS & Event Sourcing Code Walk-Through

preview_player
Показать описание
Want to see an example of how CQRS & Event Sourcing work together? Here's a code walk-through that illustrates sending commands to your domain that stores Events in an Event Store. The Events are then published to Consumers that updated Projections (read models) that are then consumed by Queries. This is the stereotypical set of patterns used when using CQRS and Event Sourcing together.

🔗 EventStoreDB

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

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

0:00 Intro
3:39 Command & Event Sourcing
7:11 Projection
10:26 Query

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

Thank you. You are amazingly clear in your explainations! No useless fillers and anecdotes, love that you just get right into the nitty gritty while everyone else seems to get lost in the nutter butter.

dirtylabrat
Автор

You’re my hero! This is the exact thing I’ve been looking for. Like the final piece of the puzzle in my mind! Thank you!

SnOrfus
Автор

Always great stuff! When I get a notification, I'm always eager to check out a new event sourcing video from you. Thanks!

TheGuitarShawn
Автор

Great video! I would love to see in more detail how you implement the projection side. Especially when adding a new projection to an existing system and having to replay events for current state

guava_dev
Автор

The only problem with this channel is that it's not that popular as it deserves to be.

romanlunin
Автор

Event Sourcing and CQRS aren’t the same thing but almost always come as a package deal. ES is optimised for writes (no locking contention) so you’re always going to end up considering a specific, separate design for the reading side. So in reality you don’t do ES without CQRS. That’s why people see them as different sides to the same coin.

danallford
Автор

nice, I'm waiting for the source code to follow along

Автор

Hey @Derek, you're doing amazing. Thank you! Please add corresponding github repo link with all of your videos. Thanks Again.

codersworld
Автор

So the projection mainly code updates the read database in turn of a business event?Thnks!

thedacian
Автор

I don't get why there are 2 tables for the same entity. Should the database really have 2 tables for the same entity for presentation purposes ? Doesn't seem right

NamEspAce-psth
Автор

Again such a fantastic video. Thank you :)

ToeShimmel
Автор

One question: which should be the response from the REST api to the UI after a command to create an entity is received?

200 OK
201 CREATED
202 ACCEPTED

germanvalenciavargas
Автор

You are the best out there! I just have one question. How do you ensure both databases are always sinchronized and no event was lost in the network?

Thanks for your videos Derek!

quicoll
Автор

Thanks for the video!

One question popped up in my mind. At around 12:15 in your video you say that you are fetching the item from the event store by applying all of the events. Why do you need to do this? - that seems like a waste of time (and potentially a very expensive thing to do, if there were many events for the item). At this point, you don't use the item for anything - you just store the "count increment" event and trigger the projections.

MrSpasify
Автор

in minute 3 diagram, should the event be written first on the Event Store, then execute the event handler for projection. Not splitting it.

RizaMarhaban
Автор

Im new to .NET core for web and not sure What stack should I use for simple Website with 3D model display and preview from database (Best Way for 3d Model store database not sure which one to pick). Maximum 50-100 models in my db.

programuoki-lt
Автор

Thanks! Just to confirm if your command api needs to read the current state of the entity before insertion then youd still need to replay events ?

bluex
Автор

in terms of use, are you able to describe, when it's best to use event sourcing and when inbox/outbox pattern is enough? I can see similar concept here and inbox/outbox pattern could also be used to republish events.

mdway
Автор

Hi, trying to implement CQRS+ES and i have a question:
What are common approaches to handle async between write and read on client side?
After sending a command how to notify client about projection update completion to run query safely?

In my case i trying to develop "smart" WS gateway to implement "subscribing on changes with query run", but it will be nice to hear some best practices, thx.

evgenvb
Автор

Can u pls implement with kafka, what do u think? And also video how to have consistency between reads n writes with segregated dbs how would u r update read DB after writes in write DB??

reynasebasti