Create job from SQL trigger

Hi there,

I’m trying to create a hangfire job when a given db record gets updated (using hangfire with SQL server). Is this supported in any way?
I tried duplicating an enqueued job record in the database, along with the state and jobparameter records. The job gets created in the database and the dashboard counters go up, but it doesn’t get run and doesn’t get shown in the list of jobs on the dashboard (so only a change in counters happens).
Hope you guys can help me out…

3 Likes

Did you ever find a solution for this? I have been thinking about a way to accomplish this also.

Yes, I ended up replicating a job created in code and parsed my own parameters in the arguments and invocationdata columns in the Job table. I also needed to create a record in the State table with the desired jobstate (“Enqueued” for default queueing). I sugggest you create a job in code and look into what’s being created.
I didn’t find any official suppor for this, so keep in mind that you might have to change the process in future versions.