HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.33k stars 1.69k forks source link

Add Arguments to Job description in Recurring Job page #505

Open yschiller opened 8 years ago

yschiller commented 8 years ago

/recurring displays only the Type.Method for the job, ignoring the parameters which are often critical in determining which job is which.

can you please add the arguments to the Job description? or perhaps add a job description field that can be used in RecurringJob.AddOrUpdate

xrkolovos commented 6 years ago

why this is never discussed?

dcorbett-radian commented 6 years ago

I don't know if this works for recurring jobs -- I'm not using them yet... but for regular jobs:

[Queue(BatchQueueNames.BatchCreateAnalysis), LogStatus, DisplayName("Create Analysis {0} {1} {2}")] void CreateAnalysisBatch(string batch, string section, string analysisRunId, AnalysisBatchRequest analysisBatchRequest, PerformContext performContext, IJobCancellationToken cancellationToken);

works quite well so that the first 3 parameters are displayed in the Hangfire UI, at least until an error happens and that info is replaced in the list.

xrkolovos commented 6 years ago

Nice I ll try it.

MovGP0 commented 5 years ago

While this may work, I don't like it. There should be the possibility to declare the display name when scheduling the job imperatively:

var state = new EnqueuedState(queue: "Default", displayName: $"Processing order for {customerName}");
var jobId = BackgroundJobClient.Create<ISomeCustomerJob>(client => client.ExecuteAsync(order, null, JobCancellationToken.Null), state);

This way I don't need add additional parameters that is not relevant for the execution of the job (ie. the description needs the customer name, but the job only needs the customer ID), because otherwise it would be a violation of the Law of Demeter.