What is Event Sourcing and CQRS? (EDA - part 3)

  Рет қаралды 84,327

A Dev' Story

A Dev' Story

Күн бұрын

Пікірлер: 61
@laakolina
@laakolina 3 жыл бұрын
Your explanations are straight to the point with very clear examples. I ended up watching the series from Getting the Basics to Event Sourcing and CQRS. Thanks for sharing your knowledge.
@ADevStory
@ADevStory 3 жыл бұрын
Glad you enjoyed it. I'm planning the next ones, any topics you would like to suggest?
@KyleRebstock
@KyleRebstock 7 ай бұрын
I've watched about 4-5 of this series so far and it's great! I love how succinct and clear you make the main points and the final presentations. Great job!
@ADevStory
@ADevStory 6 ай бұрын
Thank you very much! Glad it was useful! Please let me know of there are more topics you may be interested
@eduardoartil
@eduardoartil 3 жыл бұрын
Thank you. Your EDA series helped me pass in an interview.
@ADevStory
@ADevStory 3 жыл бұрын
Really happy to hear that!
@jhonsen9842
@jhonsen9842 3 ай бұрын
You are a gifted Teacher. You sync between explanations and clean book diagram, just MindBlowing.
@ADevStory
@ADevStory 3 ай бұрын
Thank you very much! Glad you enjoyed it!
@gokug1
@gokug1 3 жыл бұрын
Increíble el contenido que hay en esta serie de 3 videos, muy resumida y clara la información. Saludos desde México!!
@ADevStory
@ADevStory 3 жыл бұрын
¡Qué bueno que te hayas gustado! ¡Saludos!
@arick2050
@arick2050 Жыл бұрын
Super clear and simple explanations, thanks a lot for this series.
@ADevStory
@ADevStory Жыл бұрын
Glad you like them!
@politiquealgerie
@politiquealgerie Жыл бұрын
Hello, thank you for your tutorial, can you make a tutorial axon framework with CQRS & SAGA PATTERN ?
@ADevStory
@ADevStory Жыл бұрын
I typically don't make videos specifics to frameworks but what exactly do you want to know? I also have a video o the saga pattern
@LawZist
@LawZist 3 жыл бұрын
I really much agree that at the end you said to limit the use of this pattern. Can be overkill most of the time
@ADevStory
@ADevStory 3 жыл бұрын
Exactly!
@etza
@etza 2 жыл бұрын
Thank you very much, these explanations are awesome!!
@ADevStory
@ADevStory 2 жыл бұрын
Thank you! Glad you enjoyed it!
@abhisheknittala7181
@abhisheknittala7181 2 жыл бұрын
Thank you for excellent explanations and keeping simple.
@ADevStory
@ADevStory 2 жыл бұрын
Thank you! Cheers!
@PrashantShekher
@PrashantShekher 11 ай бұрын
Diagram is more intuitive and easier to understand, so thank you for this. My question is: Imagine designing a backend system for a todo list application where data consistency across Redis, PostgreSQL, and Elasticsearch is essential. To achieve this while eliminating Dual Write, two distinct approaches can be considered: Kafka with Separate Topics and Consumers: Utilizing Kafka, this approach involves creating three separate topics ("todo-cache-ingestion", "todo-storage-ingestion", and "todo-search-ingestion"). If create API call to create a new todo would publish messages to these topics. Subsequently, distinct consumer processes would handle data storage in Redis, PostgreSQL, and Elasticsearch, respectively. and what is we fetch all or specific data here? and second approach is Event Sourcing approach? But How? and what is the issue in first approach?
@ADevStory
@ADevStory 11 ай бұрын
Hello! Glad you liked the video! So probably event driven architecture doesn't fit the todo list case as well as other approaches, but let's use it for the example. One thing to consider here is that you can't have strong consistency in both reads and writes here. You may achieve eventual consistency. So for the fist case, if you read all the to dos from the list you need to decide from which system. Depending on the number of writes they may not be aligned (you may be able to search but not retrieve from cache for example). If there are no writes you may be able to eventually get them all in sync. First and second approach are similar. I'm not sure about the question. What did you mean?
@Folderq
@Folderq Жыл бұрын
Great described. Thanks!
@ADevStory
@ADevStory Жыл бұрын
You're welcome!
@1952JBoy
@1952JBoy 2 жыл бұрын
Would event sourcing be appropriate for this eccommerce checkout example? I would imagine that when a customer is checking out they would like an immediate response as to whether their order/payment was successful. With this asynchronous model there's not a guarantee of this
@ADevStory
@ADevStory 2 жыл бұрын
Those are the pros and cons of event sourcing. Payment could be synchronous if needed. Some systems value the speed of giving the service to the user and then send an email if the payment doesn't go through (for example, Google play periodic payments work like this). But it all goes down to what do you need in your case
@sepio_
@sepio_ 3 жыл бұрын
Cool videos! I would recommend you to buy a microphone as sometimes it hard to understand because of eco. Great work, can't wait for the next video!
@ADevStory
@ADevStory 3 жыл бұрын
Thanks for the tip! I have mic and that has reduced the reverberance/echo, but will try with other mics in the future.
@avvarisaiabhinav2751
@avvarisaiabhinav2751 2 жыл бұрын
good way of explanation😄🙂
@ADevStory
@ADevStory 2 жыл бұрын
Thanks! Glad you liked it!
@quanhua92
@quanhua92 8 ай бұрын
I want to ask about the Event Sourcing and CRUD. For example, an Authentication service has API to register new users and a News Feed service generates recommendation for that new user. In this case, Auth service can send USER_CREATED to the Event Log to follow the event sourcing. However, in the case that Event Log is not reachable then you will need an outbox pattern where the Auth service stores events in its local database and send to event log later. I want to ask if it is normal to not use CRUD in the register API and the register API will publish an REGISTER_USER event without storing the data, the auth service has an internal worker that will subscribe to the REGISTER_USER event to store data to its local database and then publish an USER_CREATED event for external services. In this case, no need to do an outbox pattern with the assumption that event log will be high availability.
@ADevStory
@ADevStory 7 ай бұрын
The event log should always be high availability to prevent that pattern you are mentioning, but it can still happen. It's also OK to combine the patterns as you are mentioning too. At the end these are pieces that can be put together to solve a business problem in the best way possible. Here the typical principles like "Keep It Simple" are relevant. If you can solve the problem with CRUD solve it with it as it will be simpler. If you have multiple that need to be orchestrated and Event Driven works better for you, take that path. If you are having a huge disparity between reads and writes, Event Sourcing and CQRS can help too. Hope it's clearer :)
@quanhua92
@quanhua92 7 ай бұрын
@@ADevStory thanks. I have better understanding now. The pattern where the api handlers don't perform write but publish and listen to the same events is called listen to yourself. However, for the user registration I believe that it is better to use CRUD directly at the handler and using outbox pattern to prevent event log downtime. The reason is that user's personal data is sensitive and it shouldn't be stored in the immutable event log.
@ADevStory
@ADevStory 7 ай бұрын
It can still be stored in a secured event log. Just like the database needs to be secured. You can also have retention policy for the data in the log too
@yorozuya6115
@yorozuya6115 Жыл бұрын
Hi can I mix a crud application with event sourcing? For example when I perfom an action into a Microservice A with http crud publish the event and microservice B make changes in a local cache?
@ADevStory
@ADevStory Жыл бұрын
Yes of course! So service B is doing event sourcing (and potentially CQRS) but service A is doing just a regular CRUD. That's perfectly fine.
@mohsanabbas6835
@mohsanabbas6835 3 жыл бұрын
I read on many blog posts that CQRS is not recommended for CRUD, now I am confused 😐
@ADevStory
@ADevStory 3 жыл бұрын
That's what I said. Not recommended for CRUD. If you can solve something with CRUD then skip CQRS. Hope it wasn't confusing
@pavelcardenas5745
@pavelcardenas5745 2 жыл бұрын
muchas gracias eres lo mejor
@ADevStory
@ADevStory 2 жыл бұрын
Oh gracias :)
@jurajdurej
@jurajdurej 2 жыл бұрын
nice explanation
@ADevStory
@ADevStory 2 жыл бұрын
Thanks!
@arupde6320
@arupde6320 3 жыл бұрын
keep uploading ..
@ADevStory
@ADevStory 3 жыл бұрын
Will try! Time is scarce these days 😅 what would you like to watch?
@arupde6320
@arupde6320 3 жыл бұрын
@@ADevStory upload vieos on system design .. like how aws works.. how gmail works .. like that ... explain architecture of every large scale systems ..
@ADevStory
@ADevStory 3 жыл бұрын
Sure!
@laakolina
@laakolina 3 жыл бұрын
@@ADevStory You mentioned "Time is scarce", how can I help, I would love to be your apprentice
@ADevStory
@ADevStory 3 жыл бұрын
@@laakolina thanks! Not much really, mostly sharing the channel and video if you've found it interesting and suggest topics :)
@sorteslyngel2k
@sorteslyngel2k 2 жыл бұрын
Why on earth would the orders overview service query three different services instead of building its own internal state based on events from the other services? Seems like it would nullify the pros of using this pattern.
@ADevStory
@ADevStory 2 жыл бұрын
That's a good question. Default answer: there are many ways to build the same functionality, and your approach is valid, it all depends on the context. More detailed answer: if you have the order overview service recreate the full state from all the events directly you could get more coupling and less domain separation between the services. For example, if the events used change then you need to update your Overview service, and you need to pay attention for all the possible events that are used by the different services you query (Payment, Inventory, Shipping). Some could be even vendor specific events or integrated apis (imagine Shipping is reading DHL, UPS, and USPS events, while Payment is reading Mastercard, Visa, Paypal and Stripe events). If one of those events change, then you need to change it wherever they are used. Events also become apis. In this case (for educational purposes, your mileage may vary), by having the events organized by domains and having services covering those domains, it makes it simpler for the Order Overview service to just pull the already processed data from the other services, hence the usefulness of the CQRS pattern. Hope is clearer :)
@phystem1
@phystem1 3 жыл бұрын
Hi. Really good series as I'm starting to learn about Event-Driven architecture. I couldn't differentiate Saga-Choreography from CQRS. Ideally in Choreography we would send commands/events from one service to others. And those messages can be a get/put. In CQRS aren't we are doing the same thing ? Like sending a message for get/query and sending a message for post/command. I'm jumbled up with the terminologies and everything sounds similar to me. Sorry If I'm not making any sense.
@ADevStory
@ADevStory 3 жыл бұрын
Hey Madhanraj don't worry! Learning can be hard sometimes but it's always worth! There are several things here let me try to explain it. First, design patterns / architecture patterns depend a lot on the intention. Depending on the intention certain details make sense. If you look at the details but don't see the big picture sometimes is harder to see / understand the pattern. For example you mention doing get/put to store information: get/put can be done on any service to device communication or for example between layers in a layered architecture, so it helps to see the intention and the bigger pattern. Now on the CQRS vs Choreography these are very different. In Choreography you are trying to make sure different services are coordinated by sending messages. You wouldn't do a "Get" you only send messages and services react to them. On CQRS the intention is to split the put from the get, sometimes in different services/modules/parts. That's it. You can implement it as you prefer. For example, you can have choreography between different service when you do a put,and then do a get directly from the storage or calling a other service. Hope it's clearer!:)
@phystem1
@phystem1 3 жыл бұрын
@@ADevStory Thanks for the detailed response. Much appreciated
@ADevStory
@ADevStory 3 жыл бұрын
Anytime!
@andrewdo9612
@andrewdo9612 2 жыл бұрын
Hi guys, Can I call EventLog EventStore? Because I read many post and they mentioned EventStore.
@ADevStory
@ADevStory 2 жыл бұрын
Yes it can be used interchangeably
@deecm22
@deecm22 3 жыл бұрын
Shouldn’t you have two different data stores?
@ADevStory
@ADevStory 3 жыл бұрын
Not necessarily. Or even not desirable. The pattern is more about the access to the datastore than the datastore itself
@sanjivkumar2462
@sanjivkumar2462 2 жыл бұрын
I think it makes more sense to have two different data stores. For example you may not need many indexes on write and several indexes in read
@mysocial
@mysocial 2 жыл бұрын
CQRS not well explained: not enough details
@ADevStory
@ADevStory 2 жыл бұрын
Sorry it wasn't useful to you. What would you have liked I added?
What is Service Discovery?
8:40
A Dev' Story
Рет қаралды 61 М.
The Saga Pattern in Microservices (EDA - part 2)
7:59
A Dev' Story
Рет қаралды 213 М.
Вопрос Ребром - Джиган
43:52
Gazgolder
Рет қаралды 3,8 МЛН
요즘유행 찍는법
0:34
오마이비키 OMV
Рет қаралды 12 МЛН
Event-Driven Architecture (EDA) vs Request/Response (RR)
12:00
Confluent
Рет қаралды 180 М.
Event Sourcing and CQRS Explained |  When should you use them?
12:36
Event Sourcing Example & Explained in plain English
18:23
CodeOpinion
Рет қаралды 119 М.
When to Use Kafka or RabbitMQ | System Design
8:16
Interview Pen
Рет қаралды 156 М.
CQS and CQRS: Command Query Responsibility Segregation
4:16
Drawing Boxes
Рет қаралды 29 М.
Event Sourcing • Martin Fowler • YOW! 2016
28:06
GOTO Conferences
Рет қаралды 27 М.
CQRS & Event Sourcing Code Walk-Through
14:35
CodeOpinion
Рет қаралды 46 М.
CQRS pitfalls and patterns - Udi Dahan - NDC Oslo 2023
59:26
NDC Conferences
Рет қаралды 27 М.
Вопрос Ребром - Джиган
43:52
Gazgolder
Рет қаралды 3,8 МЛН