Paul B
Paul B

Reputation: 11

Hangfire.RecurringJobExtensions calling Execute on Base Class

I'm implementing a base class for Recurring jobs in Hangfire using the RecurringJobsExtensions as follows:

public abstract class JobBase<T> : IRecurringJob
{
    public void Execute(PerformContext context)
    {
        //Do some boiler plate stuff
        this.Process(context); // Calls job specific features in derived class
        //Do some other boiler plate stuff
    }
}

public class MyJob : JobBase<MyItem>
{
    public void Process(PerformContext context)
    {
       //Do some specific stuff
    }
}

When I load this using the json file, it defines the job method as JobBase.Execute and when trying to run the job tries to instantiate the abstract class which of course won't work. How do I get this to register the type as my derived class?

Upvotes: 1

Views: 598

Answers (1)

alex.dev
alex.dev

Reputation: 170

There is an issue registered by me a long time ago: https://github.com/icsharp/Hangfire.RecurringJobExtensions/issues/4

As you can see there was no reaction, moreover the last commit into the Hangfire.RecurringJobExtensions repository was around year ago.

So you have 2 options:

  • fork the repository and fix the bug by yourself
  • develop your own extension

Upvotes: 1

Related Questions