question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide the ability to get the notification object in PublishCore

See original GitHub issue

I’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 a IEnumerable<Func<Task>>. Thanks to reflection, I would get access to the INotification object.
  • Introduce a breaking change by updating the PublishCore signature in order to provide an INotification 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:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jbogardcommented, Aug 19, 2019

And I’m open to a PR on this one

0reactions
jbogardcommented, Sep 18, 2019

Fixed by #431

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found