Great content 🎩 👏. very interesting topic, what's your approach for handling publishing failures after retry i see that you update ProcessedOnUtc so they wont be processed next time.
I think it could be nice if you use mass transit for your messaging and grpc because it has auto retry, what do you think, is it reasonable to use it in all of the projects that need messaging and grpc?
@@MilanJovanovicTech thanks a lot, and what about grpc because mass transit has grpc mode and it's exactly the same and the differences are in the startup configuration
I'm publishing domain events on before onsavechange event at dbcontext with in same unitofwork for transaction. I guess you want support retry mechanism for your domain events.. instead of this approach maybe i could hold like that kind events (queue based distributedevent) on separated list, what you think?
@@MilanJovanovicTech actually we are inserting them in outbox table.. then i can do that same as domain events on onsavechange method. This would be the guarantee for unitofwork. After that backgroundworker will check outbox table and run that jobs
Why would you want to send event before you save to database ? It might trigger a chain of business logic in other services (in worst case) for something that "never happened" (since it was not stored if it failed). Is there some way to call store AND send event with IDisposal in a given order (save -> publish)
Chicken or egg problem... 1. You save to DB 2. Publish event and it fails 3. What now? If you don't clean up DB, event won't be published properly. If you clean up DB, you end up with the same result as in the video... There isn't a 100% "clean" way to implement this when dealing with external systems.
@@gauravsingh-qt2zo object is just a generic keyword for any complex type you are needing to pass around. it won't have any access to properties or methods unless you cast it to its true type. dynamic means that you are making it 'on the fly' so to speak. you can add properties and then access them. this is good for making Json objects in c# among other things. the two keywords are quite different but this is a general overview. dynamic is dynamic in nature, hence the name. object is just a generic placeholder for any complex type.
@@thematthewyoung thanks a lot sir for your answer. I have one more question that confused me -> string? And nullable for a nullable string which one to use out of these two?
I have a question please, If a domain event is failed to be published then does polly lib will retry the same one until it succeeded and then publish the next domain event ?
Why is the resilience in this case on the place? Job runs periodicaly and when one send failed next job execue will try it again. The polly is only for speed up the sending or something hidden for me?
Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
@@cagurtay We're all just human at the end of the day 🤣🤣
Great video. The outbox pattern is very interesting topic. Thank you for present it well. Wait for new videos!
Thanks, I have a few interesting videos coming up. 😁
Great video! The library Polly is very interesting!
It really is!
Thanks for sharing!
Thanks for watching!
Outbox pattern is quite interesting
Have you used it before?
@@MilanJovanovicTech No, just seen in your code for the first time. Mostly I have used repository pattern.
Great content and explanations 👏, your topics really follow base of my bachelor project event sourced aggregate with EventStoreDB.
That seems interesting. Do you have it on GitHub?
Great content 🎩 👏. very interesting topic, what's your approach for handling publishing failures after retry i see that you update ProcessedOnUtc so they wont be processed next time.
We can also move them into a "Dead letter queue" and then try to fix them manually
I think it could be nice if you use mass transit for your messaging and grpc because it has auto retry, what do you think, is it reasonable to use it in all of the projects that need messaging and grpc?
MassTransit is an excellent option for messaging between services. If you have multiple services, I would consider MassTransit.
@@MilanJovanovicTech thanks a lot, and what about grpc because mass transit has grpc mode and it's exactly the same and the differences are in the startup configuration
@@regestea I can't say, because I didn't work with grpc much
Hi Milan,
Very interresting, but where can I find the source code?
Hey, I share the source code on Patreon
I'm publishing domain events on before onsavechange event at dbcontext with in same unitofwork for transaction. I guess you want support retry mechanism for your domain events.. instead of this approach maybe i could hold like that kind events (queue based distributedevent) on separated list, what you think?
When would you publish these events?
@@MilanJovanovicTech actually we are inserting them in outbox table.. then i can do that same as domain events on onsavechange method. This would be the guarantee for unitofwork. After that backgroundworker will check outbox table and run that jobs
How would you handle reading the messages if multiple instances of the app would exist? So you don't read / publish the same messages.
There isn't a nice way to do that with this approach. You would be better off with a queue if you need to scale like that.
A simplistic way, could be a servername column in the table, and then use it on the select statement.
@@cormerus What I was saying was a scenario with auto-scaling. In this way, I don't think said scenario would work.
Why would you want to send event before you save to database ? It might trigger a chain of business logic in other services (in worst case) for something that "never happened" (since it was not stored if it failed). Is there some way to call store AND send event with IDisposal in a given order (save -> publish)
Chicken or egg problem...
1. You save to DB
2. Publish event and it fails
3. What now? If you don't clean up DB, event won't be published properly. If you clean up DB, you end up with the same result as in the video...
There isn't a 100% "clean" way to implement this when dealing with external systems.
@@MilanJovanovicTech Yea, It's a bit complicated. I bought your book, so I've a bit reading to look forward :)
@@dondaniel7643 Hold up. Which book? 😅
I haven't released one yet.
Hey Milan..I have one question to which i didn't get satisfying answe.
Dynamic vs object????.
What do you mean by that?
@@MilanJovanovicTech I mean to say when to use object and when to use dynamic keyword????...Can u give any difference between them
@@gauravsingh-qt2zo object is just a generic keyword for any complex type you are needing to pass around. it won't have any access to properties or methods unless you cast it to its true type.
dynamic means that you are making it 'on the fly' so to speak. you can add properties and then access them. this is good for making Json objects in c# among other things.
the two keywords are quite different but this is a general overview. dynamic is dynamic in nature, hence the name. object is just a generic placeholder for any complex type.
@@thematthewyoung thanks a lot sir for your answer. I have one more question that confused me -> string? And nullable for a nullable string which one to use out of these two?
I have a question please, If a domain event is failed to be published then does polly lib will retry the same one until it succeeded and then publish the next domain event ?
You will probably retry for a fixed number of times before giving up (1-3 times)
Hi your video is awesome but the problem is your video is build on old video code so it is hard to follow when I'm new to your channel
I usually leave a link to the relevant video, so you can catch up. But I can't make every video 30-45min and explain everything from scratch.
Why is the resilience in this case on the place? Job runs periodicaly and when one send failed next job execue will try it again. The polly is only for speed up the sending or something hidden for me?
Yep, the message would normally be flagged from further processing or dead lettered