0
BassaSolutions created
- ABP Framework version: v3.3.1
Documentation https://docs.abp.io/en/abp/latest/Background-Jobs says that the jobsname can be set via an argument: [BackgroundJobName("emails")]
But in Hangfire, the jobname is then still "HangfireJobExecutionAdapter<EmailArgs>.Execute" instead of "emails".
How can the jobname be set?
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
5 Answer(s)
-
0
Hi,
Add the following code to your module:
context.Services.AddTransient(serviceProvider => { return new DashboardOptions { DisplayNameFunc = (jobContext, job) => { var jobType = serviceProvider.GetRequiredService<IOptions<AbpBackgroundJobOptions>>().Value .GetJob(job.Args.First().GetType()); return jobType.JobName; } }; });Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
I added it,the defined job name is still not displayed.
I put it directly after
// Configure Hangfire context.Services.AddHangfire(config => { config.UseSqlServerStorage(configuration.GetConnectionString("Default")); });Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
Can you share some screenshots?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
See https://github.com/abpframework/abp/pull/6701
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
I found the solution, it had to be added directly into useHangfireDashboard:
var backgroundJobOptions = context.ServiceProvider.GetRequiredService<IOptions<AbpBackgroundJobOptions>>().Value; app.UseHangfireDashboard("/jobs", new DashboardOptions { DashboardTitle = "MyProject Background Jobs", DisplayNameFunc = (jobContext, job) => { var jobType = job.Args.First().GetType(); var abpJobType = backgroundJobOptions.GetJob(jobType); return abpJobType.JobName; } });Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)