A nice and short tutorial. But how are you going to implement rollback flow in case of failure on one of the steps? It would be great to demonstrate this as well.
Great content, but you have shown happy case scenario. How to complete the implementation (with Rebus for example) if last part of saga failed? How to do "rollback" and configure it? How it works?
Hi Milan, when you first save your order into the database and then publish your order created event. I have seen a library such as CAP nuget package provide you with an atomic transaction between the database and the bus to ensure that you get both operations succeeded rather than in some cases when the message bus is offline only getting the database activity occur. It is also known as the outbox pattern.
Could you briefly describe what are the benefits of this approach compaired to direct calling of smth like IEmailSender in the mediator? As I get, it allows us to store staging state and somehow guarantee that if smth is wrong on the SMPT server side (for example), we're going to deliver the user an email anyway. Am I right?
Hi Milan, nice explanation. Just a question, based on clean architecture we should try to avoid dependencies in external libraries in the application layers - so how we can solve that?
Hi Milan, excelent explanation. Just a question, according to the examples it's possible return a value (id) after SAGA process finished? For example, to newsletters endpoint?
Hi Milan, any chance you can make a slower more background video is more beginner friendly on this important topic ? I guess giving background why use Rebus, what are the main abstractions in a Saga etc.
hi milan, thanks for your errorts, i need to implement the app you start with to implement saga pattern is there any video where you start building this app which's you begin with or you implement it alone?
Nice video, Milan! I wish the video was focused on Orchestrated SAGA in a comprehensive way, like executing different transactions in different services (maybe 3 different services), compensating steps if something failed in between, and maybe more realistic example; maybe creating order, then deduct qty in "Stock service", then bill it in an invoice (invoice service)
@@MilanJovanovicTech I will be waiting for it 👍 Long Question please bear with me: If user clicks on "Submit order" from UI and an http request sent to a Web API that starts a saga, it seems we will return a success to the user while the SAGA is still going in the backend; sending integration events for emails and other things, and other services still handling those events, maybe end up compensating for the whole Saga, what if the user doesn't want to see a success message unless we're 100% sure the saga completed successfully or error message if SAGA failed & fully compensated?
@@MilanJovanovicTech This will work but for some functions I don't think it will accept "we're processing, you will know once it's done", maybe the user has to stay on UI screen and never leave it unless a definitive result is received from SAGA about the order he's adding, in such case...I think we will need some kind of notification pushed from the server? maybe last step in SAGA (either completing/compensating) pushes SAGA result to a notification/SignalR, consumed by frontend and act upon it by showing success message and close the screen, or stay on screen and show the error/returned message, Am I right ? Is there a better way ?
It would be nice to see another important part of the Saga pattern: error handling by configuring retries and issuing a compensation transaction in a case of a fail
@@MilanJovanovicTech yes man very nice, would be great to see some compensation action if something is failed but i saw same question on other comment so will wait for that. Also what disadvantages you feel sagas have, except of implementation complexity ?
This is too much "orchestration of business logic" inside the code". I would use CAMUNDA to do all this stuff, and implement "classic handler" only. It is than up the modelled workflow in camunda to decide what to do, what to call, how to handle errors etc.
your work is valuable, and I think you have the right to ask for remuneration, but if you already monetize your videos, you still want more? what about the students who don't have the money to contribute on patreon and can't see the whole picture? In the end it turns out to be a video that they end up selling to you.
Your Patreon is expensive, $9 per month just for the source code! Love your content but damn, that's a lot. I am surprised you have 597 patrons, this youtube channel is not that big. I assume the supporters are mainly from your newsletter. Love your vids but just to get the source code that price is a steep monthly cost. I would like to support you though, I might pay for just a month and get the source code then unsubscribe.
Is that with taxes? Cause it should be $5,99. The channel may not be "big", yet. But I interact with many people, try to be helpful. By the way, how much is a cup of coffee where you're at?
Great video!! Thank you for your video, it has benefited me a lot. But I have a question, how do I guarantee that the _bus.Send method will send 100% of the messages to the RabbitMq Server after Context.SaveChanges is executed? that code is at #15:57 of this video.
Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
Thanks for the reply ❤️
simplest explanation of the saga pattern I ever heard and saw with very practical example, thank you
Thanks a lot, Iosif :)
Good video ! I can't wait to see how you will implement the compensating transactions ! Thanks Milan for your job !
Working on that one 😁
A nice and short tutorial. But how are you going to implement rollback flow in case of failure on one of the steps? It would be great to demonstrate this as well.
I'll tackle it in a future video
This is great! Are you planning on doing an error handling video on this?
That's the plan!
I was curious about this also, I'm assuming the persisted saga can resume from a given point if a step fails and is then resolved?
@@mylesdavies9476 yes in the case where it was transient. The issue for me is how do you unwind a saga if a required step fails?
@@jameshancock MassTransit has a Routing Slip pattern with compensation for activities to allow a rollback if needed.
Great content, but you have shown happy case scenario. How to complete the implementation (with Rebus for example) if last part of saga failed? How to do "rollback" and configure it? How it works?
I'll tackle that in a future video, this one was already pretty long
Hi Milan, when you first save your order into the database and then publish your order created event. I have seen a library such as CAP nuget package provide you with an atomic transaction between the database and the bus to ensure that you get both operations succeeded rather than in some cases when the message bus is offline only getting the database activity occur.
It is also known as the outbox pattern.
I'm aware 😁 I've talked about the Outbox pattern before, but didn't want to add too much complexity in a single video.
You do wonderful work in practical way. Thank you.
Thank you very much, Radek! Happy to contribute :)
Could you briefly describe what are the benefits of this approach compaired to direct calling of smth like IEmailSender in the mediator? As I get, it allows us to store staging state and somehow guarantee that if smth is wrong on the SMPT server side (for example), we're going to deliver the user an email anyway. Am I right?
Decoupling + it scales better in a microservice environment
Great video Milan!, agree with other some error/rollback logic would be very nice to see.
Keep up the good work!
On it!
Hi Milan, nice explanation. Just a question, based on clean architecture we should try to avoid dependencies in external libraries in the application layers - so how we can solve that?
With an abstraction
Hi Milan, excelent explanation. Just a question, according to the examples it's possible return a value (id) after SAGA process finished? For example, to newsletters endpoint?
The Saga is asynchronous, so your endpoint can't wait for it to complete
I may have missed a video, but do you prefer or recommend Rebus over Masstransit?
I don't prefer either one. I worked with both. From me experience, Rebus is a lot simpler to configure.
Hello. Thanks for sharing it @Milan. Could you please tell me what theme you're using for VS?
VS dark theme + ReSharper color highlighting
Hi Milan, any chance you can make a slower more background video is more beginner friendly on this important topic ? I guess giving background why use Rebus, what are the main abstractions in a Saga etc.
Yeah, good idea
Looks great, does it make sence to use this with CAP? Or the Rebus implementation already contains a CAP like functionality?
I didn't work with CAP, gotta check it out first
hi milan,
thanks for your errorts, i need to implement the app you start with to implement saga pattern
is there any video where you start building this app which's you begin with or you implement it alone?
eShop is a pretty old project, not sure where I started it. Might be ~2 year old video
Masstransit also supports Sagas?
What are pros and cons vs rebus?
Will do a deep-dive into that
Are you using CQRS pattern? I’m new to this pattern and rebus and i am curious how can we implement CQRS with rebus
CQRS is just about splitting your reads and writes logically in your code
Hi Milan !What have you got on the ApplicationAssemblyReference class ?
Static class, with a static field
Could not resolve Rebus.RabbitMq.RabbitMqTransport with decorator depth 0 - registrations: Rebus.Injection.Injectionist+Handler
What did you do different?
Can you do a video using the Saga pattern with MassTransit with mediator please.
Sure
This is a great topic , can we merge this with retry policy and dead queue in case one of consumers are down
Of course, you can add those to make it more robust
Very good content! will be nice if you make a video about massTransit
There already is one, although it's basic and doesn't cover Sagas
Nice video, Milan!
I wish the video was focused on Orchestrated SAGA in a comprehensive way, like executing different transactions in different services (maybe 3 different services), compensating steps if something failed in between, and maybe more realistic example; maybe creating order, then deduct qty in "Stock service", then bill it in an invoice (invoice service)
I've a video coming out about a failure case and compensations
@@MilanJovanovicTech I will be waiting for it 👍
Long Question please bear with me: If user clicks on "Submit order" from UI and an http request sent to a Web API that starts a saga, it seems we will return a success to the user while the SAGA is still going in the backend; sending integration events for emails and other things, and other services still handling those events, maybe end up compensating for the whole Saga, what if the user doesn't want to see a success message unless we're 100% sure the saga completed successfully or error message if SAGA failed & fully compensated?
@@alaaalnajjar1824 You show a simple message like "We're processing your order" and just orchestrate the saga accordingly
@@MilanJovanovicTech This will work but for some functions I don't think it will accept "we're processing, you will know once it's done", maybe the user has to stay on UI screen and never leave it unless a definitive result is received from SAGA about the order he's adding, in such case...I think we will need some kind of notification pushed from the server? maybe last step in SAGA (either completing/compensating) pushes SAGA result to a notification/SignalR, consumed by frontend and act upon it by showing success message and close the screen, or stay on screen and show the error/returned message, Am I right ? Is there a better way ?
Great video, very informative. Will be testing it out soon
Have fun! 😁
What is assigned to "ApplicationAssemblyReference" ?
typeof(ApplicationAssembly).Assembly
Good video Milan!
Thanks Milica :)
It would be nice to see another important part of the Saga pattern: error handling by configuring retries and issuing a compensation transaction in a case of a fail
As luck would have it, I just released such a video 😁😁
Now let's see the same pattern using a MassTransit Saga.
Perhaps, but I'll need a different example
Great video, thank you!
Glad it helped!
Great video! Why do you use Rebus to implement saga pattern and not use Masstransit?
I wanted to try out Rebus and show it to you guys :)
@@MilanJovanovicTech Will you make a video for implementing saga with masstransit?
which operating system are you using ?
Windows
@@MilanJovanovicTech i asked you this question because one of your video i see you select docker and other things linux wise.
Brate, can you say me what is your “vs template”? Font-colors are very good.
Thank you for this video. 😊
VS dark theme + ReSharper color highlighting
@@MilanJovanovicTech thank you so much brate. Pozzzic from Istanbul. 🍻😊
What will happen if the app goes down and the saga was not completed?
Since it's persisted, it can continue from it left off, assuming the messages are retried
can you recommend a good source of functional programming Milan ?
Zoran Horvat for RUclips, also any talk from Simon Painter, Scott Wlaschin
@@MilanJovanovicTech thanks alot my friend ❤️
Wow what we have here ..... interesting ))))))))
Did it meet expectiations?
@@MilanJovanovicTech yes man very nice, would be great to see some compensation action if something is failed but i saw same question on other comment so will wait for that. Also what disadvantages you feel sagas have, except of implementation complexity ?
This is Great
Thanks a lot!
Should a request handler be aware of being a part of a saga in the first place?
In which way?
This is too much "orchestration of business logic" inside the code".
I would use CAMUNDA to do all this stuff, and implement "classic handler" only.
It is than up the modelled workflow in camunda to decide what to do, what to call, how to handle errors etc.
It was supposed to be an orchestrated saga, duh
your work is valuable, and I think you have the right to ask for remuneration, but if you already monetize your videos, you still want more? what about the students who don't have the money to contribute on patreon and can't see the whole picture? In the end it turns out to be a video that they end up selling to you.
This video made a whopping $59 in 486 days, quite a lot no doubt. 😅
Try here: github.com/m-jovanovic/newsletter-orchestrated-saga
@@MilanJovanovicTech Thank you very much Milan and I am sorry for being so rude. I appreciate what you do
Your Patreon is expensive, $9 per month just for the source code! Love your content but damn, that's a lot. I am surprised you have 597 patrons, this youtube channel is not that big. I assume the supporters are mainly from your newsletter. Love your vids but just to get the source code that price is a steep monthly cost. I would like to support you though, I might pay for just a month and get the source code then unsubscribe.
Is that with taxes? Cause it should be $5,99. The channel may not be "big", yet. But I interact with many people, try to be helpful. By the way, how much is a cup of coffee where you're at?
So this is why Elsa exists lol this is crazy verbose.
Yes
Great video!! Thank you for your video, it has benefited me a lot. But I have a question, how do I guarantee that the _bus.Send method will send 100% of the messages to the RabbitMq Server after Context.SaveChanges is executed? that code is at #15:57 of this video.
Outbox pattern is as close as you can get