I was using 1.4.6. I’m upgrading to 1.5.2.
I want to pass the JobId to each job and include the JobId in each log my jobs generate. Each of my job methods has a string parameter to hold the JobId. So each method called by Hangfire might look like this:
public void ProcessReminder(string jobId, int actionId)
I was using an IServerFilter and overriding OnPerforming to pass the JobId to my job like this:
filterContext.Job.Arguments = filterContext.JobId;
With the changes between 1.4.6 and 1.5.2, Job.Arguments is deprecated. I’m supposed to use
filterContext.BackgroundJob.Job.Args instead. But Args is a read-only collection, so I can’t assign the JobId to Args.
Is there a better way of passing JobId to a job? If not and you’re not planning to add one, does Args have to be a read-only type?