Provide the ability to get the notification object in PublishCore
See original GitHub issueI’ve developed a Polly
based custom Mediator implementation, in order to add exponential retries and fallback. Therefore, it never throws an exception to the Publish
caller.
The overriden PublishCore is clean and simple :
protected override async Task PublishCore(IEnumerable<Func<Task>> allHandlers)
{
var tasks = allHandlers.Select(t => _policy.ExecuteAsync(t));
await Task.WhenAll(tasks).ConfigureAwait(false);
}
The Polly policy is defined in the constructor, but it could also be injected.
When my Fallback
policy triggers, I would like to send the failed notification to an Azure Service Bus Queue, so I can monitor it and replay it later through an Azure Function for example.
In order to achieve that, I would need to get access to the underlying INotification
object in the PublishCore
method. I see two possibilities:
- Inject a
IEnumerable<Expression<Func<Task>>>
instead of aIEnumerable<Func<Task>>
. Thanks to reflection, I would get access to theINotification
object. - Introduce a breaking change by updating the
PublishCore
signature in order to provide anINotification notification
parameter, even though it wouldn’t be used in the default implementation.
If you’re ok with the idea, I can send a PR based on the preferred solution.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
HTTP request in pending status until MediatR notifications ...
By MediatR docs the notifications is "Fire and forget" feature. I do not use await since I want to return immediately "response" object...
Read more >error when creating product variants value cannot be null ...
However when i try and save the list with the default values, I get an error every time: Value cannot be null. (Parameter...
Read more >Push Notification Service v1.10
available to send notifications. The Dashboard provides the ability to configure apps, platforms, and device-specific service parameters.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And I’m open to a PR on this one
Fixed by #431