Quantcast
Channel: User Simon_Weaver - Stack Overflow
Viewing all articles
Browse latest Browse all 116

Answer by Simon_Weaver for Disable re-queueing of failed Hangfire BackgroundJob

$
0
0

Important if using DI container with an interface, you must put the attribute on the interface definition or it won't be recognized.

public interface IDataUpdater{    [Hangfire.AutomaticRetry(Attempts = 0, OnAttemptsExceeded = AttemptsExceededAction.Delete)]    void UpdateData();}

Queue the job like this

Hangfire.RecurringJob.AddOrUpdate<IDataUpdater>(updater => updater.UpdateData(), Cron.Hourly);

Test it with throw new Exception("Test!") within your implementation. If you've done it right you'll see this in the job history under 'deleted'.

enter image description here


Viewing all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>