Publishing events default strategy - interrupted when error occured inside handler. #947
-
Hi, i'm trying to get right answer. What is my goal. I want to consume notification all handlers if it is possible and when not a retry sending. Default foreach strategy Ok. Is there a possible to create own strategy. Made loop interate over all items and save expcetion when happen. Throw it after loop is end. Or is there any better solution for this ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You'll want to create your own publish strategy for this, which is easy to do. Just create a class that implements Is this expected behavior? Yes. Is it desired? That's entirely up to you. That being said, some folks prefer to handle that logic inside the handler using something like Polly. But it's very easily extensible to do whatever you want. |
Beta Was this translation helpful? Give feedback.
You'll want to create your own publish strategy for this, which is easy to do. Just create a class that implements
INotificationPublisher
and register it inAddMediatR
with theNotificationPublisher
property.Is this expected behavior? Yes. Is it desired? That's entirely up to you.
That being said, some folks prefer to handle that logic inside the handler using something like Polly. But it's very easily extensible to do whatever you want.