Giter Site home page Giter Site logo

hangfire.recurringjobextensions's People

Contributors

icsharp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hangfire.recurringjobextensions's Issues

DependencyInjection inside Job

Hello
No way to use depency injection inside a job ? ,because
IRecurringJob must declare a public prameterless constructor

Thanks

Same job type with different job-data skipped

Hi,

I got an issue when I setup several Recurring Job from the same type but with different parameters.

The way the JobFilter is storing the Recurring Job Info in ExtendedDataJobFilter.cs L.29 avoid us to use the same type of Job more than once.
We are using a Dictionnary with the Key as a string generated from GetRecurringJobId which is using the the Type and the method name (same as the implementation of the toString in Job class in Hangfire which make the link).

In case of several job from the same type with different job-data, we only have the first one added the other one are skipped.

I tried to figured out how to solve that, but i don't have yet a good solution to offer.
Might be use the argument property of the Job, But its not very clean I think.

I will check if we can do something with the RecurringIdJob but sounds not good and huge breaking change, because Its the Id used in Hangfire itself.

Did i do something wrong?
Any input to help to solve this issue?

Edit: we can't use as well the RecurringJobId straight from the json config because we are losing it when we got the job context back in the OnPerrforming , its why I thought to use the job argument when we are adding/updating it .

ASP.Net 4.6 Compatibility?

Hi,

Is the extension compatible with .NET 4.6 projects? If so, how do I configure it in the Startup class?

Providercontext is null

Hi, am very exited about this extension. Mainly being able to use json configuration files to define jobs to be created. I had to do some tweaking to get the code running in the lastes version of Hangfire. I am experiencing however one issue that i do not understand why this is happening: It seems dat the job defined using the IRecurringJob interface is passed a null value for the PerformContext parameter in the Execute method.

The dashboard shows this:

// Job ID: #20038
using HF.TaskDefinitions;

var powerShellTask = Activate();
powerShellTask.Execute(null);

Does anyone have an idea why this might be happening. Help is much appreciated!

Unable to use context.GetJobData in any case

Dear all,

when i try to use context.GetJobData the following error occurs:

Hangfire.Common.JobLoadException: Could not load the job. See inner exception for the details. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: typeName
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
at Hangfire.Storage.InvocationData.Deserialize()
--- End of inner exception stack trace ---
at Hangfire.Storage.InvocationData.Deserialize()
at Hangfire.RecurringJobExtensions.RecurringJobInfoStorage.InternalFind(String recurringJobId, Dictionary`2 recurringJob)
at Hangfire.RecurringJobExtensions.RecurringJobInfoStorage.FindByRecurringJobId(String recurringJobId)
at Hangfire.RecurringJobExtensions.PerformContextExtensions.GetJobData(PerformContext context)
at Hangfire.RecurringJobExtensions.PerformContextExtensions.GetJobData(PerformContext context, String name)
at Hangfire.RecurringJobExtensions.PerformContextExtensions.GetJobData[T](PerformContext context, String name)
at Elpedison.ETIS.Core.API.LongRunningJob.Execute(PerformContext context) in C:\Users\k.chirikakis\Source\Repos\ETIS\Elpedison.ETIS\Elpedison.ETIS.Core.API\Jobs

Can you please help us?

Re: UseRecurringJob("recurringjob.json") Newtonsoft.Json.JsonSerializationException

Hello,

We are using your excellent hangfire extension.However, we are stuck at trying to get the recurringjob.json method of recurring jobs. we get the following error:

Newtonsoft.json.JsonSerializationException 'Error converting value to type 'System.Type.Path' [0].job-type, line 5, position 69'

Inner exception
ArgumentException: Could not cast or convert from System.String to System.Type.

it would be awesome if we could get some help with this :)

Thanks

RecurreingJobAttribute timezoneInfo not supported

i tried to set timezone for a job using the attribute, but the TimeZoneInfo is not supported as attribute parameter(by c#), my code example:
[RecurringJob("0 10 * * *", timeZone: TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time"))]
i just want to make sure that no matter what is the timezone at the machine this job will run at UTC

recurringjob.json文件中Type类型转换 .net6.0

Error converting value "Core.Time.Job.CommonJob, Core.Time.Job" to type 'System.Type'. Path '[0].job-type', line 4, position 56.

之前在.netstandard2.0中使用没有问题,但是在.net6.0中就出现以上异常信息。

No way to use base class for a job

Hi @icsharp !

As long as there is no ExecuteAsync method support (hope yet) I tried to create a base class for my jobs.

    public abstract class BaseRecurringJob : IRecurringJob
    {
        public void Execute(PerformContext context)
        {
            ExecuteAsync(context).GetAwaiter().GetResult();
        }

        protected virtual Task ExecuteAsync(PerformContext context) => Task.CompletedTask;
    }

After that all my jobs can be used like so:
public class HealthCheckRecurringJob: BaseRecurringJob

There is a problem that a Hangfire JobActivator tries to create my base abstract class instead of using child class.

As I can see there is something wrong with this line:
option.JobType.GetMethod(nameof(IRecurringJob.Execute));

var addOrUpdate = Expression.Call(
				typeof(RecurringJob),
				nameof(RecurringJob.AddOrUpdate),
				new Type[] { method.DeclaringType },
				new Expression[]
				{
					Expression.Constant(recurringJobId),
					Expression.Lambda(methodCall, x),
					Expression.Constant(cron),
					Expression.Constant(timeZone),
					Expression.Constant(queue)
				});

Could you please try to fix this issue?

Br, Alex

向大神提2个建议

向大神提2个建议:
1.JOB的配置文件希望可以能支持多个,
类似这样导入:UseRecurringJob(各个配置文件的路径的数组);
2.读入配置文件里程序集的时候,最好可以不仅仅在程序根目录查找,也可以查找配置文件所在目录;
我想象的程序目录如:
hangfireHost/
..jobs/
..job1/job1.json,job1.dll
..job2/job2.json,job2.dll
......

看好不好实现,谢谢!

Inject Dependency to constructor

Hi,

I've just want to ask how can I inject dependency in the constructor because it always calls to the non-parameter constructor.

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.