In our environment, it may happen that a Backgroundjob is requested to be scheduled more than once.
I need to be able to check if this requested job (identified by a unique id) has already been created. How do I do that?
I have only been able to create recurring jobs with an id so I can find them later, but not execute-once background jobs…
I had a similar requirement. I addressed it by adding the unique ID to the method being called for Hangfire en-queueing. Then parse the “Arguments” field of the “Job” table. Had to parse it twice, once to get out the method arguments JSON, then into a JSON object. Check the ID against internal logic to decide if scheduling that task was required.
May not be pretty, but works a treat!