Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting job display name dynamically at point of queuing #2429

Open
arynaq opened this issue Jul 25, 2024 · 1 comment
Open

Setting job display name dynamically at point of queuing #2429

arynaq opened this issue Jul 25, 2024 · 1 comment

Comments

@arynaq
Copy link

arynaq commented Jul 25, 2024

This is my dispatching to the queue

BackgroundJob.Enqueue<IMediator>( x => x.Send(new MyCommand(entity_id), cancellationToken));

This works just fine, the problem is that in the dashboard all jobs capture the expression method as name, and when something goes wrong I have to inspect each item in the dashboard to get its parameters.

image

Looking back there seemed to be a IDashboardJobNameProvider which got refactored into DisplayNameFunc in DashboardOptions. But consider this

endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions {
            DisplayNameFunc = (DashboardContext context, Job job) => {
                
                // ??? neither the context nor the job has any property that could be used to get the job name
                // job.id?
                // context.PropertyBag?
                // job.PropertyBag?
                // anything?
            }
         });

Am I missing something? I love the framework and do understand the design choice behind not too much dynamic data, but this is a simple use case I have and I am stuck.

@HernJer
Copy link

HernJer commented Jul 25, 2024

You can use the Display Name attribute or use the Tags library (FaceIT.Hangfire.Tags).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants