In "MicroServices, RabbitMQ, CQRS and Event sourcing with Node" I try to showcase how CQRS and Event sourcing can be used together. A podcast version of the channel can be found here: anchor.fm/fred...
dont know if anyone gives a shit but if you are stoned like me atm then you can stream all of the new movies on instaflixxer. Have been watching with my gf for the last couple of months :)
Sat here staring at the screen thinking.. Isn't this just like redux? Then you mentioned it too.. Fascinating video thankyou! Definitely helped me understand things more clearly than the 'talks' on these subjects
Guys, I'm a product person. I've worked with developers who used this approach on my products. I just can't relate how things listen to each other in events backbone, rabbit mq? That's fine. You throw a command to rabbit mq to do something. Then how other services learn the result of your command? The question is simply command triggers queries or queries listen to the rabbit mq and find relevant events there. How is this working? : )
In StoreService ,in the IF condition, you are finding record by event.id in the View Model. How is this possible, given all event ids would be unique(generated for command/write) .Finding by something like bidder would still make sense since an already existing record could be there for a bidder which could be reduced .Or it's just to take care in case same event flows into the read model more than once
Hey brother, thanks for sharing such valuable contents, I have a doubt regarding the placeBid function in the app.js which doesnot wait for the actual process to complete inorder to sent the response back to the user.What if something goes wrong. The user still will get a status 200 right. How is it handled.Please pardon me if the question is too dumb. Thank you.!
It's a great question actually because it comes down to a problem that is not possible to solve and that is the choice of accuracy or availability. When the user is placing bids and there is an error with the bid 2 things can happen. 1. Another bid comes in and that makes the failed bid meaningless 2. The bidding window closes and the users winning bid is not registered In scenario 1 the user is non the wiser that something went wrong and as long as the issue is a temporary one the system works as intended. In scenario 2 the previous bid will win and although there is a loss in profit the system is still working. Should the user be the only bidder they will call the company and be able to resolve the problem and remember that all of this is very unlikely to happen. If we tried to go for accuracy the overall performance of the application will go down and sometimes that is ok but if we have thousands of bids every second the cost of running that system "perfectly" will often outweigh the occasional failed bid so if we can save cost by making everything run faster and always be available we will actually make more money.
This is .NET specific but the talk shows some really interesting ideas on CQRS: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-_lwCVE_XgqI.html For learning the basics any blog article will do.
Awesome tutorial..any chance I can see the source code?Also how would aggregating state work once the event logs become too big?We cant keep building the final state from the initial state forever
github.com/fChristenson/cqrs-sourcing The event queue needs to be emptied at an arbitrary point but that doesn't matter in this case since the message has already been delivered. As for the events stored in the database the assumption of event sourcing is that you have infinite storage space. This works since you only need to recreate the views on rare occasions.
@@FredrikChristenson thanks man..so as far as i get, if I have to spin up a elastic search for a search functionality,Ill have to keep pushing the events to it everytime the command/write is issued(and acknowledged, and maybe an offset is set so it can replay in case of non acknowledgment).So the elastic search will be working on its current state at any point of time and only when it crashes, we need to rebuild it from the initial state .Also write to db being read will always be same as the actual writes, we can only chose dbs suited for both. Maybe cassandra for write(only insert) and relational(denormalized)/graph/elastic for read
Hello sir, I am your Big Fan! Your videos are always motivational sir, It would be great if you shortly explain what is SOAP/Microservices/Rest APi which is widely used in industries? #AspiringSoftwareDeveloper
@@FredrikChristenson hey :D i was thinking something.. This is cqrs, command and query segregation :D. 1) Commands should work only with events, updating just BidEventModel. 2) Query should work with BidViewModel, getting data from it. 3) app.dispatcher should be a technique to communicate between event model and view model. Listening if any new events occurred and update the view database every 5 seconds. So in StoreService class you should not call BidViewModel.findOne(event.id) on line 12 to get the current state of bid. Instead you should call BidEventModel.findAll(event.id) and reduce all the events to the current state of bid. What do you think about this?
I have once got put on a project. A finished project. It was about betting and lots of money was getting processed. When I looked at the code I remember not seeing 'anything' in the routes. There was no code in the mother fucking routes. It was a system just like this. They paid me a lot of money for 2 months. I couldnt understand the architechure and got fired. 😂 Now by time I am starting to understand. Weakest point of mine was nginx/proxy knowledge.