Aki T Aki T - 1 month ago 18
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

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