Open yschiller opened 8 years ago
why this is never discussed?
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.
Nice I ll try it.
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.
/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