Aki T Aki T - 1 year ago 124
C# Question

Use Hangfire job id in the code

I'm doing a Fire-and-Forget method invocation like this.

BackgroundJob.Enqueue(() => SendEmail(name));

I would like to pass the job id to the SendEmail() method and use it inside the method.

Answer Source

The easy way is to set a filter class. Hangfire Forum topic Use Hangfire job id in the code.